1 // Copyright (C) 2007-2014 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 (CEA/DEN)
27 #include "MEDCouplingMemArray.hxx"
28 #include "MEDCouplingUMesh.hxx"
29 #include "MEDCouplingExtrudedMesh.hxx"
30 #include "MEDCouplingCMesh.hxx"
31 #include "MEDCouplingIMesh.hxx"
32 #include "MEDCouplingCurveLinearMesh.hxx"
33 #include "MEDCoupling1GTUMesh.hxx"
34 #include "MEDCouplingField.hxx"
35 #include "MEDCouplingFieldDouble.hxx"
36 #include "MEDCouplingFieldTemplate.hxx"
37 #include "MEDCouplingGaussLocalization.hxx"
38 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
39 #include "MEDCouplingMultiFields.hxx"
40 #include "MEDCouplingFieldOverTime.hxx"
41 #include "MEDCouplingDefinitionTime.hxx"
42 #include "MEDCouplingFieldDiscretization.hxx"
43 #include "MEDCouplingCartesianAMRMesh.hxx"
44 #include "MEDCouplingAMRAttribute.hxx"
45 #include "MEDCouplingMatrix.hxx"
46 #include "MEDCouplingTypemaps.i"
48 #include "InterpKernelAutoPtr.hxx"
49 #include "BoxSplittingOptions.hxx"
51 using namespace ParaMEDMEM;
52 using namespace INTERP_KERNEL;
56 %template(ivec) std::vector<int>;
57 %template(dvec) std::vector<double>;
58 %template(svec) std::vector<std::string>;
61 %typemap(out) ParaMEDMEM::MEDCouplingMesh*
63 $result=convertMesh($1,$owner);
66 %typemap(out) MEDCouplingMesh*
68 $result=convertMesh($1,$owner);
73 %typemap(out) ParaMEDMEM::MEDCouplingPointSet*
75 $result=convertMesh($1,$owner);
78 %typemap(out) MEDCouplingPointSet*
80 $result=convertMesh($1,$owner);
85 %typemap(out) MEDCouplingCartesianAMRPatchGen*
87 $result=convertCartesianAMRPatch($1,$owner);
92 %typemap(out) MEDCouplingCartesianAMRMeshGen*
94 $result=convertCartesianAMRMesh($1,$owner);
99 %typemap(out) MEDCouplingDataForGodFather*
101 $result=convertDataForGodFather($1,$owner);
106 %typemap(out) ParaMEDMEM::MEDCoupling1GTUMesh*
108 $result=convertMesh($1,$owner);
111 %typemap(out) MEDCoupling1GTUMesh*
113 $result=convertMesh($1,$owner);
118 %typemap(out) ParaMEDMEM::MEDCouplingStructuredMesh*
120 $result=convertMesh($1,$owner);
123 %typemap(out) MEDCouplingStructuredMesh*
125 $result=convertMesh($1,$owner);
130 %typemap(out) ParaMEDMEM::MEDCouplingFieldDiscretization*
132 $result=convertFieldDiscretization($1,$owner);
135 %typemap(out) MEDCouplingFieldDiscretization*
137 $result=convertFieldDiscretization($1,$owner);
142 %typemap(out) ParaMEDMEM::MEDCouplingMultiFields*
144 $result=convertMultiFields($1,$owner);
147 %typemap(out) MEDCouplingMultiFields*
149 $result=convertMultiFields($1,$owner);
154 %init %{ import_array(); %}
157 %feature("autodoc", "1");
158 %feature("docstring");
160 %newobject ParaMEDMEM::MEDCouplingField::buildMeasureField;
161 %newobject ParaMEDMEM::MEDCouplingField::getLocalizationOfDiscr;
162 %newobject ParaMEDMEM::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
163 %newobject ParaMEDMEM::MEDCouplingFieldDouble::New;
164 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getArray;
165 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getEndArray;
166 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MergeFields;
167 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MeldFields;
168 %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct;
169 %newobject ParaMEDMEM::MEDCouplingFieldDouble::determinant;
170 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenValues;
171 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenVectors;
172 %newobject ParaMEDMEM::MEDCouplingFieldDouble::inverse;
173 %newobject ParaMEDMEM::MEDCouplingFieldDouble::trace;
174 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deviator;
175 %newobject ParaMEDMEM::MEDCouplingFieldDouble::magnitude;
176 %newobject ParaMEDMEM::MEDCouplingFieldDouble::maxPerTuple;
177 %newobject ParaMEDMEM::MEDCouplingFieldDouble::keepSelectedComponents;
178 %newobject ParaMEDMEM::MEDCouplingFieldDouble::extractSlice3D;
179 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DotFields;
180 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dot;
181 %newobject ParaMEDMEM::MEDCouplingFieldDouble::CrossProductFields;
182 %newobject ParaMEDMEM::MEDCouplingFieldDouble::crossProduct;
183 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MaxFields;
184 %newobject ParaMEDMEM::MEDCouplingFieldDouble::max;
185 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MinFields;
186 %newobject ParaMEDMEM::MEDCouplingFieldDouble::AddFields;
187 %newobject ParaMEDMEM::MEDCouplingFieldDouble::SubstractFields;
188 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MultiplyFields;
189 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DivideFields;
190 %newobject ParaMEDMEM::MEDCouplingFieldDouble::min;
191 %newobject ParaMEDMEM::MEDCouplingFieldDouble::negate;
192 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getIdsInRange;
193 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart;
194 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPartRange;
195 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__getitem__;
196 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__neg__;
197 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__add__;
198 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__sub__;
199 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__mul__;
200 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__div__;
201 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__pow__;
202 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__radd__;
203 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rsub__;
204 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rmul__;
205 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rdiv__;
206 %newobject ParaMEDMEM::MEDCouplingFieldDouble::clone;
207 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cloneWithMesh;
208 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy;
209 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
210 %newobject ParaMEDMEM::MEDCouplingFieldDouble::nodeToCellDiscretization;
211 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cellToNodeDiscretization;
212 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
213 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
214 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
215 %newobject ParaMEDMEM::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
216 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
217 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfNodesPerCell;
218 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfFacesPerCell;
219 %newobject ParaMEDMEM::MEDCouplingMesh::computeEffectiveNbOfNodesPerCell;
220 %newobject ParaMEDMEM::MEDCouplingMesh::buildPartRange;
221 %newobject ParaMEDMEM::MEDCouplingMesh::giveCellsWithType;
222 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
223 %newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
224 %newobject ParaMEDMEM::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
225 %newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
226 %newobject ParaMEDMEM::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
227 %newobject ParaMEDMEM::MEDCouplingMesh::mergeMyselfWith;
228 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic;
229 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic2;
230 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic3;
231 %newobject ParaMEDMEM::MEDCouplingMesh::getMeasureField;
232 %newobject ParaMEDMEM::MEDCouplingMesh::simplexize;
233 %newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured;
234 %newobject ParaMEDMEM::MEDCouplingMesh::MergeMeshes;
235 %newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer;
236 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellsInBoundingBox;
237 %newobject ParaMEDMEM::MEDCouplingPointSet::findBoundaryNodes;
238 %newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh;
239 %newobject ParaMEDMEM::MEDCouplingPointSet::MergeNodesArray;
240 %newobject ParaMEDMEM::MEDCouplingPointSet::buildPartOfMySelf2;
241 %newobject ParaMEDMEM::MEDCouplingPointSet::BuildInstanceFromMeshType;
242 %newobject ParaMEDMEM::MEDCouplingPointSet::zipConnectivityTraducer;
243 %newobject ParaMEDMEM::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
244 %newobject ParaMEDMEM::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
245 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellIdsLyingOnNodes;
246 %newobject ParaMEDMEM::MEDCouplingPointSet::deepCpyConnectivityOnly;
247 %newobject ParaMEDMEM::MEDCouplingPointSet::getBoundingBoxForBBTree;
248 %newobject ParaMEDMEM::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells;
249 %newobject ParaMEDMEM::MEDCouplingPointSet::__getitem__;
250 %newobject ParaMEDMEM::MEDCouplingUMesh::New;
251 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
252 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
253 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
254 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
255 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
256 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
257 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
258 %newobject ParaMEDMEM::MEDCouplingUMesh::explode3DMeshTo1D;
259 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
260 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
261 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
262 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
263 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
264 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
265 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
266 %newobject ParaMEDMEM::MEDCouplingUMesh::conformize2D;
267 %newobject ParaMEDMEM::MEDCouplingUMesh::colinearize2D;
268 %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
269 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
270 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
271 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
272 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
273 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
274 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
275 %newobject ParaMEDMEM::MEDCouplingUMesh::convertLinearCellsToQuadratic;
276 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
277 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
278 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
279 %newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField;
280 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner;
281 %newobject ParaMEDMEM::MEDCouplingUMesh::computePlaneEquationOf3DFaces;
282 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField;
283 %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
284 %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
285 %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
286 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
287 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
288 %newobject ParaMEDMEM::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
289 %newobject ParaMEDMEM::MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh;
290 %newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
291 %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
292 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis;
293 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsCrossingPlane;
294 %newobject ParaMEDMEM::MEDCouplingUMesh::convexEnvelop2D;
295 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
296 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf2DMesh;
297 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf3DMesh;
298 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
299 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
300 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic;
301 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
302 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
303 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::New;
304 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::getNodalConnectivity;
305 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
306 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::New;
307 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
308 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::computeDualMesh;
309 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
310 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::sortHexa8EachOther;
311 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
312 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
313 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::New;
314 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
315 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
316 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
317 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
318 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
319 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
320 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::buildStructuredSubPart;
321 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTUnstructured;
322 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTSubLevelMesh;
323 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
324 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom;
325 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
326 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh;
327 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::ComputeCornersGhost;
328 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
329 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
330 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
331 %newobject ParaMEDMEM::MEDCouplingIMesh::New;
332 %newobject ParaMEDMEM::MEDCouplingIMesh::asSingleCell;
333 %newobject ParaMEDMEM::MEDCouplingIMesh::buildWithGhost;
334 %newobject ParaMEDMEM::MEDCouplingIMesh::convertToCartesian;
335 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
336 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
337 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
338 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
339 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
340 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
341 %newobject ParaMEDMEM::MEDCouplingCartesianAMRPatchGen::getMesh;
342 %newobject ParaMEDMEM::MEDCouplingCartesianAMRPatchGen::__getitem__;
343 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::buildUnstructured;
344 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::extractGhostFrom;
345 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::buildMeshFromPatchEnvelop;
346 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::buildMeshOfDirectChildrenOnly;
347 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getImageMesh;
348 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getGodFather;
349 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getFather;
350 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getPatch;
351 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::createCellFieldOnPatch;
352 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::findPatchesInTheNeighborhoodOf;
353 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::__getitem__;
354 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::New;
355 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::New;
356 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::getFieldOn;
357 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::buildCellFieldOnRecurseWithoutOverlapWithoutGhost;
358 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::buildCellFieldOnWithGhost;
359 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost;
360 %newobject ParaMEDMEM::DenseMatrix::New;
361 %newobject ParaMEDMEM::DenseMatrix::deepCpy;
362 %newobject ParaMEDMEM::DenseMatrix::shallowCpy;
363 %newobject ParaMEDMEM::DenseMatrix::getData;
364 %newobject ParaMEDMEM::DenseMatrix::matVecMult;
365 %newobject ParaMEDMEM::DenseMatrix::MatVecMult;
366 %newobject ParaMEDMEM::DenseMatrix::__add__;
367 %newobject ParaMEDMEM::DenseMatrix::__sub__;
368 %newobject ParaMEDMEM::DenseMatrix::__mul__;
370 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
371 %feature("unref") MEDCouplingMesh "$this->decrRef();"
372 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
373 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
374 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
375 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
376 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
377 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
378 %feature("unref") MEDCouplingIMesh "$this->decrRef();"
379 %feature("unref") MEDCouplingCurveLinearMesh "$this->decrRef();"
380 %feature("unref") MEDCouplingField "$this->decrRef();"
381 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
382 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
383 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
384 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
385 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
386 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
387 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
388 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
389 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
390 %feature("unref") MEDCouplingCartesianAMRMeshGen "$this->decrRef();"
391 %feature("unref") MEDCouplingCartesianAMRMesh "$this->decrRef();"
392 %feature("unref") MEDCouplingCartesianAMRMeshSub "$this->decrRef();"
393 %feature("unref") MEDCouplingCartesianAMRPatchGen "$this->decrRef();"
394 %feature("unref") MEDCouplingCartesianAMRPatchGF "$this->decrRef();"
395 %feature("unref") MEDCouplingCartesianAMRPatch "$this->decrRef();"
396 %feature("unref") MEDCouplingDataForGodFather "$this->decrRef();"
397 %feature("unref") MEDCouplingAMRAttribute "$this->decrRef();"
398 %feature("unref") DenseMatrix "$this->decrRef();"
400 %rename(assign) *::operator=;
401 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
402 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
403 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
404 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
408 %rename (InterpKernelException) INTERP_KERNEL::Exception;
410 %include "MEDCouplingRefCountObject.i"
411 %include "MEDCouplingMemArray.i"
413 namespace INTERP_KERNEL
416 * \class BoxSplittingOptions
417 * Class defining the options for box splitting used for AMR algorithm like creation of patches following a criterion.
419 class BoxSplittingOptions
422 BoxSplittingOptions();
423 void init() throw(INTERP_KERNEL::Exception);
424 double getEffeciency() const throw(INTERP_KERNEL::Exception);
425 void setEffeciency(double effeciency) throw(INTERP_KERNEL::Exception);
426 double getEffeciencySnd() const throw(INTERP_KERNEL::Exception);
427 void setEffeciencySnd(double effeciencySnd) throw(INTERP_KERNEL::Exception);
428 int getMinCellDirection() const throw(INTERP_KERNEL::Exception);
429 void setMinCellDirection(int minCellDirection) throw(INTERP_KERNEL::Exception);
430 int getMaxCells() const throw(INTERP_KERNEL::Exception);
431 void setMaxCells(int maxCells) throw(INTERP_KERNEL::Exception);
432 void copyOptions(const BoxSplittingOptions & other) throw(INTERP_KERNEL::Exception);
433 std::string printOptions() const throw(INTERP_KERNEL::Exception);
436 std::string __str__() const throw(INTERP_KERNEL::Exception)
438 return self->printOptions();
460 CONST_ON_TIME_INTERVAL = 7
461 } TypeOfTimeDiscretization;
469 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
470 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
472 } MEDCouplingMeshType;
475 class DataArrayDouble;
476 class MEDCouplingUMesh;
477 class MEDCouplingFieldDouble;
479 %extend RefCountObject
481 std::string getHiddenCppPointer() const
483 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
488 %extend MEDCouplingGaussLocalization
490 std::string __str__() const throw(INTERP_KERNEL::Exception)
492 return self->getStringRepr();
495 std::string __repr__() const throw(INTERP_KERNEL::Exception)
497 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
498 oss << self->getStringRepr();
505 class MEDCouplingMesh : public RefCountObject, public TimeLabel
508 void setName(const std::string& name);
509 std::string getName() const;
510 void setDescription(const std::string& descr);
511 std::string getDescription() const;
512 void setTime(double val, int iteration, int order);
513 void setTimeUnit(const std::string& unit);
514 std::string getTimeUnit() const;
515 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
516 bool isStructured() const throw(INTERP_KERNEL::Exception);
517 virtual MEDCouplingMesh *deepCpy() const;
518 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
519 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
520 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
521 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
522 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
523 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
524 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
525 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
526 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
527 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
528 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
529 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
530 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
531 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
532 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
533 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
534 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
535 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
536 virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
537 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
538 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
539 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
540 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
541 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
542 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
544 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
545 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
546 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
547 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
548 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception);
549 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
550 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
551 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
552 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
553 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
554 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
555 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
556 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
557 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
558 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
559 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
560 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
563 std::string __str__() const throw(INTERP_KERNEL::Exception)
565 return self->simpleRepr();
568 PyObject *getTime() throw(INTERP_KERNEL::Exception)
571 double tmp0=self->getTime(tmp1,tmp2);
572 PyObject *res = PyList_New(3);
573 PyList_SetItem(res,0,SWIG_From_double(tmp0));
574 PyList_SetItem(res,1,SWIG_From_int(tmp1));
575 PyList_SetItem(res,2,SWIG_From_int(tmp2));
579 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
583 DataArrayDoubleTuple *aa;
584 std::vector<double> bb;
586 int spaceDim=self->getSpaceDimension();
587 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
588 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
589 return self->getCellContainingPoint(pos,eps);
592 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
596 DataArrayDoubleTuple *aa;
597 std::vector<double> bb;
599 int spaceDim=self->getSpaceDimension();
600 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
601 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
602 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
603 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
604 PyObject *ret=PyTuple_New(2);
605 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
606 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
610 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
612 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
613 int spaceDim=self->getSpaceDimension();
615 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
616 if (!SWIG_IsOK(res1))
619 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
620 int nbOfPoints=size/spaceDim;
623 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
625 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
629 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
631 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
632 da2->checkAllocated();
633 int size=da2->getNumberOfTuples();
634 int nbOfCompo=da2->getNumberOfComponents();
635 if(nbOfCompo!=spaceDim)
637 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
639 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
641 PyObject *ret=PyTuple_New(2);
642 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
643 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
647 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
651 DataArrayDoubleTuple *aa;
652 std::vector<double> bb;
654 int spaceDim=self->getSpaceDimension();
655 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
656 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
657 std::vector<int> elts;
658 self->getCellsContainingPoint(pos,eps,elts);
659 DataArrayInt *ret=DataArrayInt::New();
660 ret->alloc((int)elts.size(),1);
661 std::copy(elts.begin(),elts.end(),ret->getPointer());
662 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
665 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
667 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
668 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
669 self->getReverseNodalConnectivity(d0,d1);
670 PyObject *ret=PyTuple_New(2);
671 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
672 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
676 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
679 int v0; std::vector<int> v1;
680 const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
681 self->renumberCells(ids,check);
684 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
686 DataArrayInt *cellCor, *nodeCor;
687 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
688 PyObject *res = PyList_New(2);
689 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
690 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
694 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
696 DataArrayInt *cellCor=0,*nodeCor=0;
697 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
698 PyObject *res = PyList_New(2);
699 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
700 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
704 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
706 DataArrayInt *cellCor=0;
707 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
711 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
714 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
715 if (!SWIG_IsOK(res1))
718 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
719 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
723 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
725 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
726 da2->checkAllocated();
727 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
730 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
732 std::vector<int> conn;
733 self->getNodeIdsOfCell(cellId,conn);
734 return convertIntArrToPyList2(conn);
737 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
739 std::vector<double> coo;
740 self->getCoordinatesOfNode(nodeId,coo);
741 return convertDblArrToPyList2(coo);
744 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
748 DataArrayDoubleTuple *aa;
749 std::vector<double> bb;
751 int spaceDim=self->getSpaceDimension();
752 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
753 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
754 self->scale(pointPtr,factor);
757 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
759 int spaceDim=self->getSpaceDimension();
760 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
761 self->getBoundingBox(tmp);
762 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
766 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
769 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
770 PyObject *ret=PyTuple_New(2);
771 PyObject *ret0Py=ret0?Py_True:Py_False;
773 PyTuple_SetItem(ret,0,ret0Py);
774 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
778 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
780 int szArr,sw,iTypppArr;
781 std::vector<int> stdvecTyyppArr;
782 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
783 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
784 if(sw==3)//DataArrayInt
786 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
787 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
788 std::string name=argpt->getName();
790 ret->setName(name.c_str());
792 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
795 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
797 int szArr,sw,iTypppArr;
798 std::vector<int> stdvecTyyppArr;
800 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
801 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
802 if(sw==3)//DataArrayInt
804 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
805 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
806 std::string name=argpt->getName();
808 ret->setName(name.c_str());
811 PyObject *res = PyList_New(2);
812 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
813 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
814 PyList_SetItem(res,0,obj0);
815 PyList_SetItem(res,1,obj1);
819 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
823 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
824 PyObject *res = PyTuple_New(2);
825 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
828 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
830 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
831 PyTuple_SetItem(res,0,obj0);
832 PyTuple_SetItem(res,1,obj1);
836 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
838 std::vector<int> vals=self->getDistributionOfTypes();
840 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
841 PyObject *ret=PyList_New((int)vals.size()/3);
842 for(int j=0;j<(int)vals.size()/3;j++)
844 PyObject *ret1=PyList_New(3);
845 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
846 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
847 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
848 PyList_SetItem(ret,j,ret1);
853 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
855 std::vector<int> code;
856 std::vector<const DataArrayInt *> idsPerType;
857 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
858 convertPyToNewIntArr4(li,1,3,code);
859 return self->checkTypeConsistencyAndContig(code,idsPerType);
862 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
864 std::vector<int> code;
865 std::vector<DataArrayInt *> idsInPflPerType;
866 std::vector<DataArrayInt *> idsPerType;
867 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
868 PyObject *ret=PyTuple_New(3);
871 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
872 PyObject *ret0=PyList_New((int)code.size()/3);
873 for(int j=0;j<(int)code.size()/3;j++)
875 PyObject *ret00=PyList_New(3);
876 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
877 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
878 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
879 PyList_SetItem(ret0,j,ret00);
881 PyTuple_SetItem(ret,0,ret0);
883 PyObject *ret1=PyList_New(idsInPflPerType.size());
884 for(std::size_t j=0;j<idsInPflPerType.size();j++)
885 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
886 PyTuple_SetItem(ret,1,ret1);
887 int n=idsPerType.size();
888 PyObject *ret2=PyList_New(n);
890 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
891 PyTuple_SetItem(ret,2,ret2);
895 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
899 DataArrayDoubleTuple *aa;
900 std::vector<double> bb;
902 int spaceDim=self->getSpaceDimension();
903 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
904 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
905 self->translate(vectorPtr);
908 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
910 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
913 DataArrayDoubleTuple *aa;
914 std::vector<double> bb;
916 int spaceDim=self->getSpaceDimension();
917 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
918 self->rotate(centerPtr,0,alpha);
921 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
923 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
925 DataArrayDouble *a,*a2;
926 DataArrayDoubleTuple *aa,*aa2;
927 std::vector<double> bb,bb2;
929 int spaceDim=self->getSpaceDimension();
930 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
931 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
932 self->rotate(centerPtr,vectorPtr,alpha);
935 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
937 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
938 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
939 PyObject *res=PyList_New(result.size());
940 for(int i=0;iL!=result.end(); i++, iL++)
941 PyList_SetItem(res,i,PyInt_FromLong(*iL));
945 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
947 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
948 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
949 return MEDCouplingMesh::MergeMeshes(tmp);
955 //== MEDCouplingMesh End
957 %include "NormalizedGeometricTypes"
958 %include "MEDCouplingNatureOfFieldEnum"
962 class MEDCouplingNatureOfField
965 static const char *GetRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception);
966 static std::string GetReprNoThrow(NatureOfField nat);
967 static std::string GetAllPossibilitiesStr();
971 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
972 // include "MEDCouplingTimeDiscretization.i"
976 class MEDCouplingGaussLocalization
979 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
980 const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
981 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
982 INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
983 void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
984 int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
985 int getDimension() const throw(INTERP_KERNEL::Exception);
986 int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
987 std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
988 void checkCoherency() const throw(INTERP_KERNEL::Exception);
989 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception);
991 const std::vector<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
992 double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
993 const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
994 double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
995 const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
996 double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
997 void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
998 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
999 void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
1000 void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
1001 void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
1002 void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
1004 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
1008 %include "MEDCouplingFieldDiscretization.i"
1010 //== MEDCouplingPointSet
1012 namespace ParaMEDMEM
1014 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
1017 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
1018 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
1019 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
1020 void zipCoords() throw(INTERP_KERNEL::Exception);
1021 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
1022 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
1023 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
1024 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
1025 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
1026 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
1027 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
1028 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
1029 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
1030 static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception);
1031 virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
1032 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
1033 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
1034 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
1035 virtual DataArrayInt *findBoundaryNodes() const;
1036 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
1037 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
1038 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
1039 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
1040 virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
1041 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1044 std::string __str__() const throw(INTERP_KERNEL::Exception)
1046 return self->simpleRepr();
1049 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
1052 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1053 PyObject *res = PyList_New(2);
1054 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1055 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
1059 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
1061 DataArrayInt *comm, *commIndex;
1062 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1063 PyObject *res = PyList_New(2);
1064 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1065 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1069 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
1071 DataArrayDouble *ret1=self->getCoords();
1074 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
1077 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
1079 int szArr,sw,iTypppArr;
1080 std::vector<int> stdvecTyyppArr;
1081 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1082 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1083 if(sw==3)//DataArrayInt
1085 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1086 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1087 std::string name=argpt->getName();
1089 ret->setName(name.c_str());
1091 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1094 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1096 int szArr,sw,iTypppArr;
1097 std::vector<int> stdvecTyyppArr;
1098 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1099 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1100 if(sw==3)//DataArrayInt
1102 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1103 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1104 std::string name=argpt->getName();
1106 ret->setName(name.c_str());
1108 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1111 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
1113 int szArr,sw,iTypppArr;
1114 std::vector<int> stdvecTyyppArr;
1115 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1116 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1117 if(sw==3)//DataArrayInt
1119 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1120 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1121 std::string name=argpt->getName();
1123 ret->setName(name.c_str());
1125 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1128 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1130 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1131 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1134 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1136 int szArr,sw,iTypppArr;
1137 std::vector<int> stdvecTyyppArr;
1138 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1139 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1140 if(sw==3)//DataArrayInt
1142 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1143 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1144 std::string name=argpt->getName();
1146 ret->setName(name.c_str());
1148 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1151 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1153 int szArr,sw,iTypppArr;
1154 std::vector<int> stdvecTyyppArr;
1155 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1156 self->renumberNodes(tmp,newNbOfNodes);
1159 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1161 int szArr,sw,iTypppArr;
1162 std::vector<int> stdvecTyyppArr;
1163 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1164 self->renumberNodes2(tmp,newNbOfNodes);
1167 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1169 int spaceDim=self->getSpaceDimension();
1171 DataArrayDouble *a,*a2;
1172 DataArrayDoubleTuple *aa,*aa2;
1173 std::vector<double> bb,bb2;
1175 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1176 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1177 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1178 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1179 std::vector<int> nodes;
1180 self->findNodesOnLine(p,v,eps,nodes);
1181 DataArrayInt *ret=DataArrayInt::New();
1182 ret->alloc((int)nodes.size(),1);
1183 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1184 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1186 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1188 int spaceDim=self->getSpaceDimension();
1190 DataArrayDouble *a,*a2;
1191 DataArrayDoubleTuple *aa,*aa2;
1192 std::vector<double> bb,bb2;
1194 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1195 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1196 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1197 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1198 std::vector<int> nodes;
1199 self->findNodesOnPlane(p,v,eps,nodes);
1200 DataArrayInt *ret=DataArrayInt::New();
1201 ret->alloc((int)nodes.size(),1);
1202 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1203 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1206 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1210 DataArrayDoubleTuple *aa;
1211 std::vector<double> bb;
1213 int spaceDim=self->getSpaceDimension();
1214 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1215 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1216 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1217 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1220 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1222 DataArrayInt *c=0,*cI=0;
1226 DataArrayDoubleTuple *aa;
1227 std::vector<double> bb;
1229 int spaceDim=self->getSpaceDimension();
1230 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1231 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1232 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1233 PyObject *ret=PyTuple_New(2);
1234 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1235 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1239 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1241 DataArrayInt *c=0,*cI=0;
1242 int spaceDim=self->getSpaceDimension();
1245 DataArrayDoubleTuple *aa;
1246 std::vector<double> bb;
1249 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1250 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1252 PyObject *ret=PyTuple_New(2);
1253 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1254 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1258 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1262 DataArrayDoubleTuple *aa;
1263 std::vector<double> bb;
1265 int spaceDim=self->getSpaceDimension();
1266 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1267 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1269 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1270 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1273 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1277 std::vector<int> multiVal;
1278 std::pair<int, std::pair<int,int> > slic;
1279 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1280 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1284 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1286 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1288 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1290 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1294 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1296 DataArrayInt *v0=0,*v1=0;
1297 self->findCommonCells(compType,startCellId,v0,v1);
1298 PyObject *res = PyList_New(2);
1299 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1300 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1305 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1308 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1309 if (!SWIG_IsOK(res1))
1312 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1313 self->renumberNodesInConn(tmp);
1317 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1319 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1320 da2->checkAllocated();
1321 self->renumberNodesInConn(da2->getConstPointer());
1325 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1328 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1329 PyObject *ret=PyTuple_New(2);
1330 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1331 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1335 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1337 DataArrayInt *ret=0;
1339 int szArr,sw,iTypppArr;
1340 std::vector<int> stdvecTyyppArr;
1341 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1342 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1346 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1350 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1351 PyObject *res = PyList_New(3);
1352 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1353 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1354 PyList_SetItem(res,2,SWIG_From_int(ret2));
1358 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1362 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1363 PyObject *res = PyList_New(3);
1364 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1365 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1366 PyList_SetItem(res,2,SWIG_From_int(ret2));
1370 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1373 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1374 if (!SWIG_IsOK(res1))
1377 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1378 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1382 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1384 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1385 da2->checkAllocated();
1386 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1390 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1394 std::vector<int> multiVal;
1395 std::pair<int, std::pair<int,int> > slic;
1396 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1397 int nbc=self->getNumberOfCells();
1398 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1405 std::ostringstream oss;
1406 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1407 throw INTERP_KERNEL::Exception(oss.str().c_str());
1410 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1415 int tmp=nbc+singleVal;
1416 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1420 std::ostringstream oss;
1421 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1422 throw INTERP_KERNEL::Exception(oss.str().c_str());
1428 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1432 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1437 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1438 daIntTyypp->checkAllocated();
1439 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1442 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1446 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1449 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1450 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1451 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1452 for(int i=0;i<sz;i++)
1453 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1456 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1459 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1461 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1462 std::vector<double> val3;
1463 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1464 "Rotate2DAlg",2,true,nbNodes);
1466 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1467 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1470 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1473 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1474 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1475 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1476 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1477 for(int i=0;i<sz;i++)
1478 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1481 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1484 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1486 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1487 std::vector<double> val3;
1488 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1489 "Rotate3DAlg",3,true,nbNodes);
1491 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1492 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1493 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1498 //== MEDCouplingPointSet End
1500 class MEDCouplingUMeshCell
1503 INTERP_KERNEL::NormalizedCellType getType() const;
1506 std::string __str__() const throw(INTERP_KERNEL::Exception)
1508 return self->repr();
1511 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1514 const int *r=self->getAllConn(ret2);
1515 PyObject *ret=PyTuple_New(ret2);
1516 for(int i=0;i<ret2;i++)
1517 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1523 class MEDCouplingUMeshCellIterator
1530 MEDCouplingUMeshCell *ret=self->nextt();
1532 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1535 PyErr_SetString(PyExc_StopIteration,"No more data.");
1542 class MEDCouplingUMeshCellByTypeIterator
1545 ~MEDCouplingUMeshCellByTypeIterator();
1550 MEDCouplingUMeshCellEntry *ret=self->nextt();
1552 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1555 PyErr_SetString(PyExc_StopIteration,"No more data.");
1562 class MEDCouplingUMeshCellByTypeEntry
1565 ~MEDCouplingUMeshCellByTypeEntry();
1568 MEDCouplingUMeshCellByTypeIterator *__iter__()
1570 return self->iterator();
1575 class MEDCouplingUMeshCellEntry
1578 INTERP_KERNEL::NormalizedCellType getType() const;
1579 int getNumberOfElems() const;
1582 MEDCouplingUMeshCellIterator *__iter__()
1584 return self->iterator();
1589 //== MEDCouplingUMesh
1591 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1594 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1595 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1596 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1597 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1598 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1599 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1600 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1601 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1602 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1603 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1604 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1605 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1606 void computeTypes() throw(INTERP_KERNEL::Exception);
1607 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1608 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1610 DataArrayInt *conformize2D(double eps) throw(INTERP_KERNEL::Exception);
1611 DataArrayInt *colinearize2D(double eps) throw(INTERP_KERNEL::Exception);
1612 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1613 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1614 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1615 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1616 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1617 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1618 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1619 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1620 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1621 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1622 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1623 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1624 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1625 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1626 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1627 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1628 bool isFullyQuadratic() const throw(INTERP_KERNEL::Exception);
1629 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1630 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1631 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1632 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1633 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1634 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1635 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1636 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1637 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1638 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1639 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1640 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1641 DataArrayDouble *computePlaneEquationOf3DFaces() const throw(INTERP_KERNEL::Exception);
1642 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1643 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1644 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1645 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1646 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1647 DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1648 DataArrayInt *buildUnionOf2DMesh() const throw(INTERP_KERNEL::Exception);
1649 DataArrayInt *buildUnionOf3DMesh() const throw(INTERP_KERNEL::Exception);
1650 DataArrayDouble *getBoundingBoxForBBTreeFast() const throw(INTERP_KERNEL::Exception);
1651 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1652 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1653 int split2DCells(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI, const DataArrayInt *midOpt=0, const DataArrayInt *midOptI=0) throw(INTERP_KERNEL::Exception);
1654 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1655 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1656 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1657 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1658 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1660 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1662 return MEDCouplingUMesh::New();
1665 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1667 return MEDCouplingUMesh::New(meshName,meshDim);
1670 std::string __str__() const throw(INTERP_KERNEL::Exception)
1672 return self->simpleRepr();
1675 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1677 std::ostringstream oss;
1678 self->reprQuickOverview(oss);
1682 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1684 return self->cellIterator();
1687 PyObject *getAllGeoTypesSorted() const throw(INTERP_KERNEL::Exception)
1689 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
1690 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1691 PyObject *res=PyList_New(result.size());
1692 for(int i=0;iL!=result.end(); i++, iL++)
1693 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1697 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1701 std::vector<int> multiVal;
1702 std::pair<int, std::pair<int,int> > slic;
1703 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1704 int nbc=self->getNumberOfCells();
1705 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1712 std::ostringstream oss;
1713 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1714 throw INTERP_KERNEL::Exception(oss.str().c_str());
1718 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1725 int tmp=nbc+singleVal;
1726 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1731 std::ostringstream oss;
1732 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1733 throw INTERP_KERNEL::Exception(oss.str().c_str());
1739 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1745 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1746 daIntTyypp->checkAllocated();
1747 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1751 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1755 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1759 std::vector<int> multiVal;
1760 std::pair<int, std::pair<int,int> > slic;
1761 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1762 int nbc=self->getNumberOfCells();
1763 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1770 std::ostringstream oss;
1771 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1772 throw INTERP_KERNEL::Exception(oss.str().c_str());
1776 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1783 int tmp=nbc+singleVal;
1784 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1789 std::ostringstream oss;
1790 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1791 throw INTERP_KERNEL::Exception(oss.str().c_str());
1797 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1802 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1808 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1809 daIntTyypp->checkAllocated();
1810 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1814 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1818 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1820 int szArr,sw,iTypppArr;
1821 std::vector<int> stdvecTyyppArr;
1822 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1825 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1826 throw INTERP_KERNEL::Exception(oss.str().c_str());
1828 self->insertNextCell(type,size,tmp);
1831 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1833 int szArr,sw,iTypppArr;
1834 std::vector<int> stdvecTyyppArr;
1835 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1836 self->insertNextCell(type,szArr,tmp);
1839 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1841 DataArrayInt *ret=self->getNodalConnectivity();
1846 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1848 DataArrayInt *ret=self->getNodalConnectivityIndex();
1854 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1856 int szArr,sw,iTypppArr;
1857 std::vector<int> stdvecTyyppArr;
1858 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1859 int nbOfDepthPeelingPerformed=0;
1860 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1861 PyObject *res=PyTuple_New(2);
1862 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1863 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1867 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1869 DataArrayInt *v0=0,*v1=0;
1870 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1871 PyObject *res = PyList_New(2);
1872 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1873 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1877 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1881 DataArrayDoubleTuple *aa;
1882 std::vector<double> bb;
1884 int nbOfCompo=self->getSpaceDimension();
1885 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1888 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1889 PyObject *ret=PyTuple_New(2);
1890 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1891 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1895 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1897 DataArrayInt *ret1=0;
1898 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1899 PyObject *ret=PyTuple_New(2);
1900 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1901 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1905 PyObject *tetrahedrize(int policy) throw(INTERP_KERNEL::Exception)
1908 DataArrayInt *ret1(0);
1909 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
1910 PyObject *ret=PyTuple_New(3);
1911 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
1912 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1913 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
1917 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1919 std::vector<int> cells;
1920 self->checkButterflyCells(cells,eps);
1921 DataArrayInt *ret=DataArrayInt::New();
1922 ret->alloc((int)cells.size(),1);
1923 std::copy(cells.begin(),cells.end(),ret->getPointer());
1924 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1927 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1929 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1931 PyObject *ret = PyList_New(sz);
1932 for(int i=0;i<sz;i++)
1933 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1937 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1939 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1940 int sz=retCpp.size();
1941 PyObject *ret=PyList_New(sz);
1942 for(int i=0;i<sz;i++)
1943 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1947 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1950 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1951 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1952 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1955 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1958 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1959 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1963 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1966 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1967 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1971 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1973 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1974 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1975 PyObject *ret=PyTuple_New(3);
1976 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1977 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1978 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1982 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1984 DataArrayInt *tmp0=0,*tmp1=0;
1985 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1986 PyObject *ret=PyTuple_New(2);
1987 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1988 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1992 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1996 std::vector<int> multiVal;
1997 std::pair<int, std::pair<int,int> > slic;
1998 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1999 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2003 return self->duplicateNodes(&singleVal,&singleVal+1);
2005 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
2007 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
2009 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2013 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
2017 std::vector<int> multiVal;
2018 std::pair<int, std::pair<int,int> > slic;
2019 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2020 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2024 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
2026 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
2028 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
2030 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2034 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
2037 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
2038 DataArrayInt *tmp0,*tmp1=0;
2039 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2040 PyObject *ret=PyTuple_New(2);
2041 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2042 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2046 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const throw(INTERP_KERNEL::Exception)
2048 DataArrayInt *ret0=0,*ret1=0;
2049 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
2050 PyObject *ret=PyTuple_New(2);
2051 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2052 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2056 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2058 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2059 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2060 DataArrayInt *ret1=0,*ret2=0;
2061 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2062 PyObject *ret=PyTuple_New(3);
2063 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2064 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2065 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2069 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2071 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2072 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2073 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2074 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2077 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
2080 std::vector<const MEDCouplingUMesh *> meshes;
2081 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2082 std::vector<DataArrayInt *> corr;
2083 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2085 PyObject *ret1=PyList_New(sz);
2086 for(int i=0;i<sz;i++)
2087 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2088 PyObject *ret=PyList_New(2);
2089 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2090 PyList_SetItem(ret,1,ret1);
2094 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2096 std::vector<MEDCouplingUMesh *> meshes;
2097 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2098 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2101 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
2103 std::vector<MEDCouplingUMesh *> meshes;
2104 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2105 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2108 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
2112 std::vector<int> multiVal;
2113 std::pair<int, std::pair<int,int> > slic;
2114 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2116 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2117 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2121 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2123 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2125 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2127 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2131 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2133 DataArrayInt *arrOut=0,*arrIndexOut=0;
2136 std::vector<int> multiVal;
2137 std::pair<int, std::pair<int,int> > slic;
2138 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2140 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2141 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2146 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2151 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2156 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2160 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2162 PyObject *ret=PyTuple_New(2);
2163 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2164 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2168 static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2170 DataArrayInt *arrOut=0,*arrIndexOut=0;
2171 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2172 PyObject *ret=PyTuple_New(2);
2173 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2174 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2178 static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2180 if(!PySlice_Check(slic))
2181 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !");
2182 Py_ssize_t strt=2,stp=2,step=2;
2183 PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
2185 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !");
2186 arrIndxIn->checkAllocated();
2187 if(arrIndxIn->getNumberOfComponents()!=1)
2188 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !");
2189 GetIndicesOfSlice(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !");
2190 DataArrayInt *arrOut=0,*arrIndexOut=0;
2191 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2192 PyObject *ret=PyTuple_New(2);
2193 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2194 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2198 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2199 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2200 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2202 DataArrayInt *arrOut=0,*arrIndexOut=0;
2205 std::vector<int> multiVal;
2206 std::pair<int, std::pair<int,int> > slic;
2207 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2209 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2210 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2215 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2220 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2225 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2229 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2231 PyObject *ret=PyTuple_New(2);
2232 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2233 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2237 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2238 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2242 std::vector<int> multiVal;
2243 std::pair<int, std::pair<int,int> > slic;
2244 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2246 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2247 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2252 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2257 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2262 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2266 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2270 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2274 DataArrayDoubleTuple *aa;
2275 std::vector<double> bb;
2277 int spaceDim=self->getSpaceDimension();
2278 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2279 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2281 std::vector<int> cells;
2282 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2283 DataArrayInt *ret=DataArrayInt::New();
2284 ret->alloc((int)cells.size(),1);
2285 std::copy(cells.begin(),cells.end(),ret->getPointer());
2286 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2289 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2293 DataArrayDoubleTuple *aa;
2294 std::vector<double> bb;
2296 int spaceDim=self->getSpaceDimension();
2297 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2298 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2299 self->orientCorrectly2DCells(v,polyOnly);
2302 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2304 std::vector<int> cells;
2305 self->arePolyhedronsNotCorrectlyOriented(cells);
2306 DataArrayInt *ret=DataArrayInt::New();
2307 ret->alloc((int)cells.size(),1);
2308 std::copy(cells.begin(),cells.end(),ret->getPointer());
2309 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2312 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2316 self->getFastAveragePlaneOfThis(vec,pos);
2318 std::copy(vec,vec+3,vals);
2319 std::copy(pos,pos+3,vals+3);
2320 return convertDblArrToPyListOfTuple(vals,3,2);
2323 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2325 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2326 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2327 return MEDCouplingUMesh::MergeUMeshes(tmp);
2330 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2333 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2334 PyObject *ret=PyTuple_New(2);
2335 PyObject *ret0Py=ret0?Py_True:Py_False;
2337 PyTuple_SetItem(ret,0,ret0Py);
2338 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2342 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2345 bool ret0=self->areCellsIncludedIn2(other,ret1);
2346 PyObject *ret=PyTuple_New(2);
2347 PyObject *ret0Py=ret0?Py_True:Py_False;
2349 PyTuple_SetItem(ret,0,ret0Py);
2350 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2354 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2356 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2357 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2358 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2359 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2360 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2361 PyObject *ret=PyTuple_New(5);
2362 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2363 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2364 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2365 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2366 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2370 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2372 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2373 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2374 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2375 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2376 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2377 PyObject *ret=PyTuple_New(5);
2378 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2379 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2380 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2381 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2382 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2386 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2388 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2389 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2390 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2391 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2392 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2393 PyObject *ret=PyTuple_New(5);
2394 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2395 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2396 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2397 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2398 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2402 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2404 DataArrayInt *neighbors=0,*neighborsIdx=0;
2405 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2406 PyObject *ret=PyTuple_New(2);
2407 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2408 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2412 PyObject *computeNeighborsOfNodes() const throw(INTERP_KERNEL::Exception)
2414 DataArrayInt *neighbors=0,*neighborsIdx=0;
2415 self->computeNeighborsOfNodes(neighbors,neighborsIdx);
2416 PyObject *ret=PyTuple_New(2);
2417 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2418 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2422 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2424 DataArrayInt *neighbors=0,*neighborsIdx=0;
2425 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2426 PyObject *ret=PyTuple_New(2);
2427 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2428 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2432 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2434 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2435 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2436 DataArrayInt *d2,*d3,*d4,*dd5;
2437 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2438 PyObject *ret=PyTuple_New(7);
2439 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2440 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2441 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2442 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2443 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2444 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2445 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2449 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2452 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2453 da->checkAllocated();
2454 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2457 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2460 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2461 da->checkAllocated();
2462 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2465 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2468 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2469 da->checkAllocated();
2470 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2473 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2476 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2477 da->checkAllocated();
2478 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2479 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2480 PyObject *res = PyList_New(result.size());
2481 for (int i=0;iL!=result.end(); i++, iL++)
2482 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2486 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2489 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2490 da->checkAllocated();
2491 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2492 ret->setName(da->getName().c_str());
2496 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2498 DataArrayInt *cellNb1=0,*cellNb2=0;
2499 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2500 PyObject *ret=PyTuple_New(3);
2501 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2502 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2503 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2507 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2509 int spaceDim=self->getSpaceDimension();
2511 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2513 DataArrayDouble *a,*a2;
2514 DataArrayDoubleTuple *aa,*aa2;
2515 std::vector<double> bb,bb2;
2517 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2518 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2519 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2520 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2522 DataArrayInt *cellIds=0;
2523 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2524 PyObject *ret=PyTuple_New(2);
2525 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2526 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2530 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2532 int spaceDim=self->getSpaceDimension();
2534 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2536 DataArrayDouble *a,*a2;
2537 DataArrayDoubleTuple *aa,*aa2;
2538 std::vector<double> bb,bb2;
2540 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2541 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2542 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2543 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2545 DataArrayInt *cellIds=0;
2546 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2547 PyObject *ret=PyTuple_New(2);
2548 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2549 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2553 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2555 int spaceDim=self->getSpaceDimension();
2557 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2559 DataArrayDouble *a,*a2;
2560 DataArrayDoubleTuple *aa,*aa2;
2561 std::vector<double> bb,bb2;
2563 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2564 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2565 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2566 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2567 return self->getCellIdsCrossingPlane(orig,vect,eps);
2570 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2574 std::vector<int> pos2;
2575 DataArrayInt *pos3=0;
2576 DataArrayIntTuple *pos4=0;
2577 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2582 self->convertToPolyTypes(&pos1,&pos1+1);
2589 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2594 self->convertToPolyTypes(pos3->begin(),pos3->end());
2598 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2602 void convertAllToPoly();
2603 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2604 bool unPolyze() throw(INTERP_KERNEL::Exception);
2605 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2606 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2607 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2610 //== MEDCouplingUMesh End
2612 //== MEDCouplingExtrudedMesh
2614 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2617 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2618 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2620 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2622 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2625 std::string __str__() const throw(INTERP_KERNEL::Exception)
2627 return self->simpleRepr();
2630 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2632 std::ostringstream oss;
2633 self->reprQuickOverview(oss);
2637 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2639 MEDCouplingUMesh *ret=self->getMesh2D();
2642 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2644 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2646 MEDCouplingUMesh *ret=self->getMesh1D();
2649 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2651 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2653 DataArrayInt *ret=self->getMesh3DIds();
2656 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2661 //== MEDCouplingExtrudedMesh End
2663 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2666 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2667 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2668 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2669 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2670 virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2671 virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
2674 virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2676 int szArr,sw,iTypppArr;
2677 std::vector<int> stdvecTyyppArr;
2678 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2679 self->insertNextCell(tmp,tmp+szArr);
2682 virtual DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2684 DataArrayInt *ret=self->getNodalConnectivity();
2685 if(ret) ret->incrRef();
2689 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2691 std::vector< const MEDCoupling1GTUMesh *> parts;
2692 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
2693 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
2698 //== MEDCoupling1SGTUMesh
2700 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2703 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2704 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2705 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2706 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2707 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2708 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2709 MEDCoupling1GTUMesh *computeDualMesh() const throw(INTERP_KERNEL::Exception);
2710 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const throw(INTERP_KERNEL::Exception);
2711 DataArrayInt *sortHexa8EachOther() throw(INTERP_KERNEL::Exception);
2714 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2716 return MEDCoupling1SGTUMesh::New(name,type);
2719 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2721 return MEDCoupling1SGTUMesh::New(m);
2724 std::string __str__() const throw(INTERP_KERNEL::Exception)
2726 return self->simpleRepr();
2729 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2731 std::ostringstream oss;
2732 self->reprQuickOverview(oss);
2736 PyObject *structurizeMe(double eps=1e-12) const throw(INTERP_KERNEL::Exception)
2738 DataArrayInt *cellPerm(0),*nodePerm(0);
2739 MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps));
2740 PyObject *ret(PyTuple_New(3));
2741 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 ));
2742 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2743 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2747 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2749 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2750 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2751 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2754 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2756 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2757 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2758 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2763 //== MEDCoupling1SGTUMesh End
2765 //== MEDCoupling1DGTUMesh
2767 class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2770 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2771 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2772 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
2773 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2774 bool isPacked() const throw(INTERP_KERNEL::Exception);
2777 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2779 return MEDCoupling1DGTUMesh::New(name,type);
2782 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2784 return MEDCoupling1DGTUMesh::New(m);
2787 std::string __str__() const throw(INTERP_KERNEL::Exception)
2789 return self->simpleRepr();
2792 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2794 std::ostringstream oss;
2795 self->reprQuickOverview(oss);
2799 DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
2801 DataArrayInt *ret=self->getNodalConnectivityIndex();
2802 if(ret) ret->incrRef();
2806 PyObject *retrievePackedNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2808 DataArrayInt *ret1=0,*ret2=0;
2809 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
2810 PyObject *ret0Py=ret0?Py_True:Py_False;
2812 PyObject *ret=PyTuple_New(3);
2813 PyTuple_SetItem(ret,0,ret0Py);
2814 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2815 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2819 PyObject *copyWithNodalConnectivityPacked() const throw(INTERP_KERNEL::Exception)
2822 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
2823 PyObject *ret=PyTuple_New(2);
2824 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
2825 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
2826 PyTuple_SetItem(ret,1,ret1Py);
2830 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2832 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2833 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2834 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
2837 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2839 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2840 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2841 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
2844 static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt) throw(INTERP_KERNEL::Exception)
2846 std::vector<const ParaMEDMEM::DataArrayInt *> tmp;
2847 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2848 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
2853 //== MEDCoupling1DGTUMeshEnd
2855 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2858 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2859 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2860 int getNumberOfCellsOfSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2861 int getSpaceDimensionOnNodeStruct() const throw(INTERP_KERNEL::Exception);
2862 virtual std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2863 std::vector<int> getCellGridStructure() const throw(INTERP_KERNEL::Exception);
2864 MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception);
2865 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
2866 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2867 static int DeduceNumberOfGivenStructure(const std::vector<int>& st) throw(INTERP_KERNEL::Exception);
2868 static DataArrayInt *ComputeCornersGhost(const std::vector<int>& st, int ghostLev) throw(INTERP_KERNEL::Exception);
2869 static std::vector<int> GetSplitVectFromStruct(const std::vector<int>& strct) throw(INTERP_KERNEL::Exception);
2872 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const throw(INTERP_KERNEL::Exception)
2874 int tmpp1=-1,tmpp2=-1;
2875 std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
2876 std::vector< std::pair<int,int> > inp;
2880 for(int i=0;i<tmpp1;i++)
2881 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2886 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
2887 inp.resize(tmpp1/2);
2888 for(int i=0;i<tmpp1/2;i++)
2889 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2892 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
2893 return self->buildStructuredSubPart(inp);
2896 static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) throw(INTERP_KERNEL::Exception)
2898 std::vector< std::pair<int,int> > inp;
2899 convertPyToVectorPairInt(part,inp);
2901 int szArr,sw,iTypppArr;
2902 std::vector<int> stdvecTyyppArr;
2903 const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
2904 std::vector<int> tmp5(tmp4,tmp4+szArr);
2906 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
2909 static void MultiplyPartOf(const std::vector<int>& st, PyObject *part, double factor, DataArrayDouble *da) throw(INTERP_KERNEL::Exception)
2911 std::vector< std::pair<int,int> > inp;
2912 convertPyToVectorPairInt(part,inp);
2913 MEDCouplingStructuredMesh::MultiplyPartOf(st,inp,factor,da);
2916 static void MultiplyPartOfByGhost(const std::vector<int>& st, PyObject *part, int ghostSize, double factor, DataArrayDouble *da) throw(INTERP_KERNEL::Exception)
2918 std::vector< std::pair<int,int> > inp;
2919 convertPyToVectorPairInt(part,inp);
2920 MEDCouplingStructuredMesh::MultiplyPartOfByGhost(st,inp,ghostSize,factor,da);
2923 static PyObject *PutInGhostFormat(int ghostSize, const std::vector<int>& st, PyObject *part) throw(INTERP_KERNEL::Exception)
2925 std::vector< std::pair<int,int> > inp;
2926 convertPyToVectorPairInt(part,inp);
2927 std::vector<int> stWithGhost;
2928 std::vector< std::pair<int,int> > partWithGhost;
2929 MEDCouplingStructuredMesh::PutInGhostFormat(ghostSize,st,inp,stWithGhost,partWithGhost);
2930 PyObject *ret(PyTuple_New(2));
2931 PyTuple_SetItem(ret,0,convertIntArrToPyList2(stWithGhost));
2932 PyTuple_SetItem(ret,1,convertFromVectorPairInt(partWithGhost));
2936 static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector<int>& st, const DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat) throw(INTERP_KERNEL::Exception)
2938 std::vector< std::pair<int,int> > inp;
2939 convertPyToVectorPairInt(partCompactFormat,inp);
2940 return MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,fieldOfDbl,inp);
2943 static int DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part) throw(INTERP_KERNEL::Exception)
2945 std::vector< std::pair<int,int> > inp;
2946 convertPyToVectorPairInt(part,inp);
2947 return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp);
2950 static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) throw(INTERP_KERNEL::Exception)
2952 int szArr,sw,iTypppArr;
2953 std::vector<int> stdvecTyyppArr;
2954 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2955 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
2958 static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2960 int szArr,sw,iTypppArr;
2961 std::vector<int> stdvecTyyppArr;
2962 const int *tmp(convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr));
2963 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
2966 static std::vector<int> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat) throw(INTERP_KERNEL::Exception)
2968 std::vector< std::pair<int,int> > inp;
2969 convertPyToVectorPairInt(partCompactFormat,inp);
2970 return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp);
2973 static PyObject *GetCompactFrmtFromDimensions(const std::vector<int>& dims) throw(INTERP_KERNEL::Exception)
2975 std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dims));
2976 PyObject *retPy=PyList_New(ret.size());
2977 for(std::size_t i=0;i<ret.size();i++)
2979 PyObject *tmp=PyTuple_New(2);
2980 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
2981 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
2982 PyList_SetItem(retPy,i,tmp);
2987 static PyObject *IntersectRanges(PyObject *r1, PyObject *r2) throw(INTERP_KERNEL::Exception)
2989 std::vector< std::pair<int,int> > r1Cpp,r2Cpp;
2990 convertPyToVectorPairInt(r1,r1Cpp);
2991 convertPyToVectorPairInt(r2,r2Cpp);
2992 std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::IntersectRanges(r1Cpp,r2Cpp));
2993 PyObject *retPy=PyList_New(ret.size());
2994 for(std::size_t i=0;i<ret.size();i++)
2996 PyObject *tmp=PyTuple_New(2);
2997 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
2998 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
2999 PyList_SetItem(retPy,i,tmp);
3004 static PyObject *IsPartStructured(PyObject *li, PyObject *st) throw(INTERP_KERNEL::Exception)
3006 int szArr,sw,iTypppArr;
3007 std::vector<int> stdvecTyyppArr;
3008 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3009 int szArr2,sw2,iTypppArr2;
3010 std::vector<int> stdvecTyyppArr2;
3011 const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
3012 std::vector<int> tmp3(tmp2,tmp2+szArr2);
3013 std::vector< std::pair<int,int> > partCompactFormat;
3014 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
3015 PyObject *ret=PyTuple_New(2);
3016 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
3017 PyTuple_SetItem(ret,0,ret0Py);
3018 PyObject *ret1Py=PyList_New(partCompactFormat.size());
3019 for(std::size_t i=0;i<partCompactFormat.size();i++)
3021 PyObject *tmp4=PyTuple_New(2);
3022 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
3023 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
3024 PyList_SetItem(ret1Py,i,tmp4);
3026 PyTuple_SetItem(ret,1,ret1Py);
3030 static PyObject *ChangeReferenceFromGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigInAbs, bool check=true) throw(INTERP_KERNEL::Exception)
3032 std::vector< std::pair<int,int> > param0,param1,ret;
3033 convertPyToVectorPairInt(bigInAbs,param0);
3034 convertPyToVectorPairInt(partOfBigInAbs,param1);
3035 MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(param0,param1,ret,check);
3036 PyObject *retPy(PyList_New(ret.size()));
3037 for(std::size_t i=0;i<ret.size();i++)
3039 PyObject *tmp(PyTuple_New(2));
3040 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3041 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3042 PyList_SetItem(retPy,i,tmp);
3047 static PyObject *TranslateCompactFrmt(PyObject *part, const std::vector<int>& translation) throw(INTERP_KERNEL::Exception)
3049 std::vector< std::pair<int,int> > param0;
3050 convertPyToVectorPairInt(part,param0);
3051 std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::TranslateCompactFrmt(param0,translation));
3052 PyObject *retPy(PyList_New(ret.size()));
3053 for(std::size_t i=0;i<ret.size();i++)
3055 PyObject *tmp(PyTuple_New(2));
3056 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3057 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3058 PyList_SetItem(retPy,i,tmp);
3063 static std::vector<int> FindTranslationFrom(PyObject *startingFrom, PyObject *goingTo) throw(INTERP_KERNEL::Exception)
3065 std::vector< std::pair<int,int> > param0,param1;
3066 convertPyToVectorPairInt(startingFrom,param0);
3067 convertPyToVectorPairInt(goingTo,param1);
3068 return MEDCouplingStructuredMesh::FindTranslationFrom(param0,param1);
3071 static PyObject *ChangeReferenceToGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigRelativeToBig, bool check=true) throw(INTERP_KERNEL::Exception)
3073 std::vector< std::pair<int,int> > param0,param1,ret;
3074 convertPyToVectorPairInt(bigInAbs,param0);
3075 convertPyToVectorPairInt(partOfBigRelativeToBig,param1);
3076 MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(param0,param1,ret,check);
3077 PyObject *retPy(PyList_New(ret.size()));
3078 for(std::size_t i=0;i<ret.size();i++)
3080 PyObject *tmp(PyTuple_New(2));
3081 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3082 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3083 PyList_SetItem(retPy,i,tmp);
3090 //== MEDCouplingCMesh
3092 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3095 static MEDCouplingCMesh *New() throw(INTERP_KERNEL::Exception);
3096 static MEDCouplingCMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
3097 MEDCouplingCMesh *clone(bool recDeepCpy) const;
3098 void setCoords(const DataArrayDouble *coordsX,
3099 const DataArrayDouble *coordsY=0,
3100 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
3101 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
3103 MEDCouplingCMesh() throw(INTERP_KERNEL::Exception)
3105 return MEDCouplingCMesh::New();
3107 MEDCouplingCMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
3109 return MEDCouplingCMesh::New(meshName);
3111 std::string __str__() const throw(INTERP_KERNEL::Exception)
3113 return self->simpleRepr();
3115 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3117 std::ostringstream oss;
3118 self->reprQuickOverview(oss);
3121 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
3123 DataArrayDouble *ret=self->getCoordsAt(i);
3131 //== MEDCouplingCMesh End
3133 //== MEDCouplingCurveLinearMesh
3135 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3138 static MEDCouplingCurveLinearMesh *New() throw(INTERP_KERNEL::Exception);
3139 static MEDCouplingCurveLinearMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
3140 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
3141 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
3143 MEDCouplingCurveLinearMesh() throw(INTERP_KERNEL::Exception)
3145 return MEDCouplingCurveLinearMesh::New();
3147 MEDCouplingCurveLinearMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
3149 return MEDCouplingCurveLinearMesh::New(meshName);
3151 std::string __str__() const throw(INTERP_KERNEL::Exception)
3153 return self->simpleRepr();
3155 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3157 std::ostringstream oss;
3158 self->reprQuickOverview(oss);
3161 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
3163 DataArrayDouble *ret=self->getCoords();
3168 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
3170 int szArr,sw,iTypppArr;
3171 std::vector<int> stdvecTyyppArr;
3172 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
3173 self->setNodeGridStructure(tmp,tmp+szArr);
3178 //== MEDCouplingCurveLinearMesh End
3180 //== MEDCouplingIMesh
3182 class MEDCouplingIMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3185 static MEDCouplingIMesh *New() throw(INTERP_KERNEL::Exception);
3187 void setSpaceDimension(int spaceDim) throw(INTERP_KERNEL::Exception);
3188 std::vector<int> getNodeStruct() const throw(INTERP_KERNEL::Exception);
3189 std::vector<double> getOrigin() const throw(INTERP_KERNEL::Exception);
3190 std::vector<double> getDXYZ() const throw(INTERP_KERNEL::Exception);
3191 void setAxisUnit(const std::string& unitName) throw(INTERP_KERNEL::Exception);
3192 std::string getAxisUnit() const throw(INTERP_KERNEL::Exception);
3193 double getMeasureOfAnyCell() const throw(INTERP_KERNEL::Exception);
3194 MEDCouplingCMesh *convertToCartesian() const throw(INTERP_KERNEL::Exception);
3195 void refineWithFactor(const std::vector<int>& factors) throw(INTERP_KERNEL::Exception);
3196 MEDCouplingIMesh *asSingleCell() const throw(INTERP_KERNEL::Exception);
3197 MEDCouplingIMesh *buildWithGhost(int ghostLev) const throw(INTERP_KERNEL::Exception);
3202 return MEDCouplingIMesh::New();
3204 static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3206 static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
3207 static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
3208 const int *nodeStrctPtr(0);
3209 const double *originPtr(0),*dxyzPtr(0);
3211 std::vector<int> bb0;
3212 nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
3215 std::vector<double> bb,bb2;
3217 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
3218 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
3220 return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
3223 MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3225 return ParaMEDMEM_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
3228 void setNodeStruct(PyObject *nodeStrct) throw(INTERP_KERNEL::Exception)
3231 std::vector<int> bb0;
3232 const int *nodeStrctPtr(convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0));
3233 self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
3236 void setOrigin(PyObject *origin) throw(INTERP_KERNEL::Exception)
3238 static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3241 DataArrayDoubleTuple *aa;
3242 std::vector<double> bb;
3244 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
3245 self->setOrigin(originPtr,originPtr+nbTuples);
3248 void setDXYZ(PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3250 static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3253 DataArrayDoubleTuple *aa;
3254 std::vector<double> bb;
3256 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
3257 self->setDXYZ(originPtr,originPtr+nbTuples);
3260 static void CondenseFineToCoarse(const std::vector<int>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, DataArrayDouble *coarseDA) throw(INTERP_KERNEL::Exception)
3262 std::vector< std::pair<int,int> > inp;
3263 convertPyToVectorPairInt(fineLocInCoarse,inp);
3264 MEDCouplingIMesh::CondenseFineToCoarse(coarseSt,fineDA,inp,facts,coarseDA);
3267 static void CondenseFineToCoarseGhost(const std::vector<int>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, DataArrayDouble *coarseDA, int ghostSize) throw(INTERP_KERNEL::Exception)
3269 std::vector< std::pair<int,int> > inp;
3270 convertPyToVectorPairInt(fineLocInCoarse,inp);
3271 MEDCouplingIMesh::CondenseFineToCoarseGhost(coarseSt,fineDA,inp,facts,coarseDA,ghostSize);
3274 static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts) throw(INTERP_KERNEL::Exception)
3276 std::vector< std::pair<int,int> > inp;
3277 convertPyToVectorPairInt(fineLocInCoarse,inp);
3278 MEDCouplingIMesh::SpreadCoarseToFine(coarseDA,coarseSt,fineDA,inp,facts);
3281 static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, int ghostSize) throw(INTERP_KERNEL::Exception)
3283 std::vector< std::pair<int,int> > inp;
3284 convertPyToVectorPairInt(fineLocInCoarse,inp);
3285 MEDCouplingIMesh::SpreadCoarseToFineGhost(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3288 static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, int ghostSize) throw(INTERP_KERNEL::Exception)
3290 std::vector< std::pair<int,int> > inp;
3291 convertPyToVectorPairInt(fineLocInCoarse,inp);
3292 MEDCouplingIMesh::SpreadCoarseToFineGhostZone(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3295 std::string __str__() const throw(INTERP_KERNEL::Exception)
3297 return self->simpleRepr();
3299 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3301 std::ostringstream oss;
3302 self->reprQuickOverview(oss);
3308 //== MEDCouplingIMesh End
3312 namespace ParaMEDMEM
3314 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
3317 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
3318 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
3319 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3320 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3321 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
3322 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
3323 void setName(const char *name) throw(INTERP_KERNEL::Exception);
3324 std::string getDescription() const throw(INTERP_KERNEL::Exception);
3325 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
3326 std::string getName() const throw(INTERP_KERNEL::Exception);
3327 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
3328 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
3329 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
3330 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
3331 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
3332 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
3333 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
3334 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3335 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
3336 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
3337 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
3338 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
3339 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
3340 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
3341 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
3342 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3344 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
3346 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3349 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3352 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
3354 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3357 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3360 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
3362 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
3363 return convertIntArrToPyList3(ret);
3366 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
3369 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
3370 PyObject *ret=PyTuple_New(2);
3371 PyObject *ret0Py=ret0?Py_True:Py_False;
3373 PyTuple_SetItem(ret,0,ret0Py);
3374 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3378 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
3380 DataArrayInt *ret1=0;
3381 MEDCouplingMesh *ret0=0;
3383 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3384 if (!SWIG_IsOK(res1))
3387 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3388 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3392 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3394 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3395 da2->checkAllocated();
3396 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3398 PyObject *res = PyList_New(2);
3399 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3400 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3404 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
3406 DataArrayInt *ret1=0;
3408 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3409 PyObject *res=PyTuple_New(2);
3410 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3412 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3415 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3416 PyTuple_SetItem(res,1,res1);
3421 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3424 int v0; std::vector<int> v1;
3425 const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
3426 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3429 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3430 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3433 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3434 if (!SWIG_IsOK(res1))
3437 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3438 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3442 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3444 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3445 da2->checkAllocated();
3446 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3450 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3452 std::vector<int> tmp;
3453 self->getCellIdsHavingGaussLocalization(locId,tmp);
3454 DataArrayInt *ret=DataArrayInt::New();
3455 ret->alloc((int)tmp.size(),1);
3456 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3457 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3460 int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
3462 std::vector<int> inp0;
3463 convertPyToNewIntArr4(code,1,3,inp0);
3464 std::vector<const DataArrayInt *> inp1;
3465 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(idsPerType,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",inp1);
3466 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3471 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3474 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3475 static MEDCouplingFieldTemplate *New(TypeOfField type);
3476 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3477 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3480 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3482 return MEDCouplingFieldTemplate::New(f);
3485 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3487 return MEDCouplingFieldTemplate::New(type);
3490 std::string __str__() const throw(INTERP_KERNEL::Exception)
3492 return self->simpleRepr();
3495 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3497 std::ostringstream oss;
3498 self->reprQuickOverview(oss);
3504 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3507 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3508 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3509 void setTimeUnit(const std::string& unit);
3510 std::string getTimeUnit() const;
3511 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3512 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3513 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3514 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3515 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3516 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
3517 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3518 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3519 MEDCouplingFieldDouble *deepCpy() const;
3520 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3521 MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
3522 MEDCouplingFieldDouble *cellToNodeDiscretization() const throw(INTERP_KERNEL::Exception);
3523 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3524 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3525 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3526 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3527 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3528 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3529 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3530 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3531 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3532 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3533 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
3534 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3535 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3536 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3537 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3538 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3539 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3540 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3541 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3542 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3543 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3544 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3545 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3546 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3547 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3548 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3549 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3550 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3551 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3552 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3553 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3554 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3555 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3556 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3557 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3558 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3559 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3560 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3561 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3562 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3563 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3564 void fillFromAnalytic(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3565 void fillFromAnalytic2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3566 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3567 void applyFunc(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3568 void applyFunc2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3569 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3570 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3571 void applyFunc(const std::string& func) throw(INTERP_KERNEL::Exception);
3572 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
3573 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
3574 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3575 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3576 double getMinValue() const throw(INTERP_KERNEL::Exception);
3577 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3578 double norm2() const throw(INTERP_KERNEL::Exception);
3579 double normMax() const throw(INTERP_KERNEL::Exception);
3580 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3581 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3582 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3583 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3584 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3585 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3586 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3587 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3588 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3589 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3590 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3591 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3592 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3593 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3594 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3595 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3596 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3597 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3598 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3599 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3600 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3601 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3603 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3605 return MEDCouplingFieldDouble::New(type,td);
3608 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3610 return MEDCouplingFieldDouble::New(ft,td);
3613 std::string __str__() const throw(INTERP_KERNEL::Exception)
3615 return self->simpleRepr();
3618 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3620 std::ostringstream oss;
3621 self->reprQuickOverview(oss);
3625 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3627 DataArrayDouble *ret=self->getArray();
3633 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3635 std::vector<DataArrayDouble *> arrs=self->getArrays();
3636 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3640 PyObject *ret=PyTuple_New(sz);
3641 for(int i=0;i<sz;i++)
3644 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3646 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3651 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3653 std::vector<const DataArrayDouble *> tmp;
3654 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3656 std::vector<DataArrayDouble *> arrs(sz);
3657 for(int i=0;i<sz;i++)
3658 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3659 self->setArrays(arrs);
3662 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3664 DataArrayDouble *ret=self->getEndArray();
3670 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3674 DataArrayDoubleTuple *aa;
3675 std::vector<double> bb;
3677 const MEDCouplingMesh *mesh=self->getMesh();
3679 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3680 int spaceDim=mesh->getSpaceDimension();
3681 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3682 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3684 int sz=self->getNumberOfComponents();
3685 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3686 self->getValueOn(spaceLoc,res);
3687 return convertDblArrToPyList(res,sz);
3690 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3692 int sz=self->getNumberOfComponents();
3693 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3694 self->getValueOnPos(i,j,k,res);
3695 return convertDblArrToPyList(res,sz);
3698 DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
3700 const MEDCouplingMesh *mesh(self->getMesh());
3702 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3705 double v0; ParaMEDMEM::DataArrayDouble *v1(0); ParaMEDMEM::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
3706 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
3707 mesh->getSpaceDimension(),true,nbPts);
3708 return self->getValueOnMulti(inp,nbPts);
3711 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3715 DataArrayDoubleTuple *aa;
3716 std::vector<double> bb;
3718 const MEDCouplingMesh *mesh=self->getMesh();
3720 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3721 int spaceDim=mesh->getSpaceDimension();
3722 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3723 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3726 int sz=self->getNumberOfComponents();
3727 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3728 self->getValueOn(spaceLoc,time,res);
3729 return convertDblArrToPyList(res,sz);
3732 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3734 if(self->getArray()!=0)
3735 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3738 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3739 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3740 self->setArray(arr);
3744 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3747 double tmp0=self->getTime(tmp1,tmp2);
3748 PyObject *res = PyList_New(3);
3749 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3750 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3751 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3755 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3758 double tmp0=self->getStartTime(tmp1,tmp2);
3759 PyObject *res = PyList_New(3);
3760 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3761 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3762 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3766 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3769 double tmp0=self->getEndTime(tmp1,tmp2);
3770 PyObject *res = PyList_New(3);
3771 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3772 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3773 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3776 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3778 int sz=self->getNumberOfComponents();
3779 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3780 self->accumulate(tmp);
3781 return convertDblArrToPyList(tmp,sz);
3783 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3785 int sz=self->getNumberOfComponents();
3786 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3787 self->integral(isWAbs,tmp);
3788 return convertDblArrToPyList(tmp,sz);
3790 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3792 int sz=self->getNumberOfComponents();
3793 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3794 self->getWeightedAverageValue(tmp,isWAbs);
3795 return convertDblArrToPyList(tmp,sz);
3797 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3799 int sz=self->getNumberOfComponents();
3800 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3802 return convertDblArrToPyList(tmp,sz);
3804 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3806 int sz=self->getNumberOfComponents();
3807 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3809 return convertDblArrToPyList(tmp,sz);
3811 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3813 int szArr,sw,iTypppArr;
3814 std::vector<int> stdvecTyyppArr;
3815 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3816 self->renumberCells(tmp,check);
3819 void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3821 int szArr,sw,iTypppArr;
3822 std::vector<int> stdvecTyyppArr;
3823 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3824 self->renumberCellsWithoutMesh(tmp,check);
3827 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3829 int szArr,sw,iTypppArr;
3830 std::vector<int> stdvecTyyppArr;
3831 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3832 self->renumberNodes(tmp,eps);
3835 void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3837 int szArr,sw,iTypppArr;
3838 std::vector<int> stdvecTyyppArr;
3839 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3840 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
3843 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3847 std::vector<int> multiVal;
3848 std::pair<int, std::pair<int,int> > slic;
3849 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3850 const MEDCouplingMesh *mesh=self->getMesh();
3852 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3853 int nbc=mesh->getNumberOfCells();
3854 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3861 std::ostringstream oss;
3862 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3863 throw INTERP_KERNEL::Exception(oss.str().c_str());
3866 return self->buildSubPart(&singleVal,&singleVal+1);
3871 int tmp=nbc+singleVal;
3872 return self->buildSubPart(&tmp,&tmp+1);
3876 std::ostringstream oss;
3877 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3878 throw INTERP_KERNEL::Exception(oss.str().c_str());
3884 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3888 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3893 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3894 daIntTyypp->checkAllocated();
3895 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3898 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3902 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3904 const char msg[]="MEDCouplingFieldDouble::__getitem__ : invalid call Available API are : \n-myField[dataArrayInt]\n-myField[slice]\n-myField[pythonListOfCellIds]\n-myField[integer]\n-myField[dataArrayInt,1]\n-myField[slice,1]\n-myField[pythonListOfCellIds,1]\n-myField[integer,1]\n";
3905 if(PyTuple_Check(li))
3907 Py_ssize_t sz=PyTuple_Size(li);
3909 throw INTERP_KERNEL::Exception(msg);
3910 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3913 std::vector<int> multiVal;
3914 std::pair<int, std::pair<int,int> > slic;
3915 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3916 if(!self->getArray())
3917 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3919 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3920 catch(INTERP_KERNEL::Exception& e)
3921 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3922 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3923 DataArrayDouble *ret0Arr=ret0->getArray();
3925 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3930 std::vector<int> v2(1,singleVal);
3931 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3932 ret0->setArray(aarr);
3937 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3938 ret0->setArray(aarr);
3943 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3944 std::vector<int> v2(nbOfComp);
3945 for(int i=0;i<nbOfComp;i++)
3946 v2[i]=slic.first+i*slic.second.second;
3947 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3948 ret0->setArray(aarr);
3952 throw INTERP_KERNEL::Exception(msg);
3957 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3960 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3963 double r1=self->getMaxValue2(tmp);
3964 PyObject *ret=PyTuple_New(2);
3965 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3966 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3970 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3973 double r1=self->getMinValue2(tmp);
3974 PyObject *ret=PyTuple_New(2);
3975 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3976 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3980 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3982 std::vector<int> tmp;
3983 convertPyToNewIntArr3(li,tmp);
3984 return self->keepSelectedComponents(tmp);
3987 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3989 std::vector<int> tmp;
3990 convertPyToNewIntArr3(li,tmp);
3991 self->setSelectedComponents(f,tmp);
3994 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3997 DataArrayDouble *a,*a2;
3998 DataArrayDoubleTuple *aa,*aa2;
3999 std::vector<double> bb,bb2;
4002 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
4003 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
4004 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
4005 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
4007 return self->extractSlice3D(orig,vect,eps);
4010 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4012 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
4015 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4017 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
4020 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4022 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.";
4023 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
4026 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4028 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4030 return (*self)-(*other);
4032 throw INTERP_KERNEL::Exception(msg);
4037 DataArrayDoubleTuple *aa;
4038 std::vector<double> bb;
4040 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4045 if(!self->getArray())
4046 throw INTERP_KERNEL::Exception(msg2);
4047 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
4048 ret->applyLin(1.,-val);
4049 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4050 ret2->setArray(ret);
4055 if(!self->getArray())
4056 throw INTERP_KERNEL::Exception(msg2);
4057 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
4058 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4059 ret2->setArray(ret);
4064 if(!self->getArray())
4065 throw INTERP_KERNEL::Exception(msg2);
4066 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4067 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4068 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4069 ret2->setArray(ret);
4074 if(!self->getArray())
4075 throw INTERP_KERNEL::Exception(msg2);
4076 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4077 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4078 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4079 ret2->setArray(ret);
4083 { throw INTERP_KERNEL::Exception(msg); }
4087 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4089 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
4092 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4094 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
4097 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4099 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
4102 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4104 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.";
4105 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
4108 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4110 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4112 return (*self)/(*other);
4114 throw INTERP_KERNEL::Exception(msg);
4119 DataArrayDoubleTuple *aa;
4120 std::vector<double> bb;
4122 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4128 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
4129 if(!self->getArray())
4130 throw INTERP_KERNEL::Exception(msg2);
4131 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
4132 ret->applyLin(1./val,0);
4133 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4134 ret2->setArray(ret);
4139 if(!self->getArray())
4140 throw INTERP_KERNEL::Exception(msg2);
4141 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
4142 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4143 ret2->setArray(ret);
4148 if(!self->getArray())
4149 throw INTERP_KERNEL::Exception(msg2);
4150 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4151 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4152 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4153 ret2->setArray(ret);
4158 if(!self->getArray())
4159 throw INTERP_KERNEL::Exception(msg2);
4160 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4161 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4162 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4163 ret2->setArray(ret);
4167 { throw INTERP_KERNEL::Exception(msg); }
4171 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4173 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
4176 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4178 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.";
4179 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
4182 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4184 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4186 return (*self)^(*other);
4188 throw INTERP_KERNEL::Exception(msg);
4193 DataArrayDoubleTuple *aa;
4194 std::vector<double> bb;
4196 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4201 if(!self->getArray())
4202 throw INTERP_KERNEL::Exception(msg2);
4203 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
4205 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4206 ret2->setArray(ret);
4211 if(!self->getArray())
4212 throw INTERP_KERNEL::Exception(msg2);
4213 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
4214 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4215 ret2->setArray(ret);
4220 if(!self->getArray())
4221 throw INTERP_KERNEL::Exception(msg2);
4222 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4223 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4224 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4225 ret2->setArray(ret);
4230 if(!self->getArray())
4231 throw INTERP_KERNEL::Exception(msg2);
4232 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4233 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4234 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4235 ret2->setArray(ret);
4239 { throw INTERP_KERNEL::Exception(msg); }
4243 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
4245 return self->negate();
4248 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4250 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.";
4251 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
4254 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4256 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4260 Py_XINCREF(trueSelf);
4264 throw INTERP_KERNEL::Exception(msg);
4269 DataArrayDoubleTuple *aa;
4270 std::vector<double> bb;
4272 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4277 if(!self->getArray())
4278 throw INTERP_KERNEL::Exception(msg2);
4279 self->getArray()->applyLin(1.,val);
4280 Py_XINCREF(trueSelf);
4285 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4288 Py_XINCREF(trueSelf);
4293 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4294 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4295 ret2->setArray(aaa);
4297 Py_XINCREF(trueSelf);
4302 if(!self->getArray())
4303 throw INTERP_KERNEL::Exception(msg2);
4304 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4305 self->getArray()->addEqual(aaa);
4306 Py_XINCREF(trueSelf);
4310 { throw INTERP_KERNEL::Exception(msg); }
4314 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4316 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.";
4317 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4320 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4322 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4326 Py_XINCREF(trueSelf);
4330 throw INTERP_KERNEL::Exception(msg);
4335 DataArrayDoubleTuple *aa;
4336 std::vector<double> bb;
4338 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4343 if(!self->getArray())
4344 throw INTERP_KERNEL::Exception(msg2);
4345 self->getArray()->applyLin(1.,-val);
4346 Py_XINCREF(trueSelf);
4351 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4354 Py_XINCREF(trueSelf);
4359 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4360 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4361 ret2->setArray(aaa);
4363 Py_XINCREF(trueSelf);
4368 if(!self->getArray())
4369 throw INTERP_KERNEL::Exception(msg2);
4370 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4371 self->getArray()->substractEqual(aaa);
4372 Py_XINCREF(trueSelf);
4376 { throw INTERP_KERNEL::Exception(msg); }
4380 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4382 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.";
4383 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4386 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4388 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4392 Py_XINCREF(trueSelf);
4396 throw INTERP_KERNEL::Exception(msg);
4401 DataArrayDoubleTuple *aa;
4402 std::vector<double> bb;
4404 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4409 if(!self->getArray())
4410 throw INTERP_KERNEL::Exception(msg2);
4411 self->getArray()->applyLin(val,0);
4412 Py_XINCREF(trueSelf);
4417 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4420 Py_XINCREF(trueSelf);
4425 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4426 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4427 ret2->setArray(aaa);
4429 Py_XINCREF(trueSelf);
4434 if(!self->getArray())
4435 throw INTERP_KERNEL::Exception(msg2);
4436 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4437 self->getArray()->multiplyEqual(aaa);
4438 Py_XINCREF(trueSelf);
4442 { throw INTERP_KERNEL::Exception(msg); }
4446 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4448 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.";
4449 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4452 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4454 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4458 Py_XINCREF(trueSelf);
4462 throw INTERP_KERNEL::Exception(msg);
4467 DataArrayDoubleTuple *aa;
4468 std::vector<double> bb;
4470 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4476 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4477 if(!self->getArray())
4478 throw INTERP_KERNEL::Exception(msg2);
4479 self->getArray()->applyLin(1./val,0);
4480 Py_XINCREF(trueSelf);
4485 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4488 Py_XINCREF(trueSelf);
4493 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4494 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4495 ret2->setArray(aaa);
4497 Py_XINCREF(trueSelf);
4502 if(!self->getArray())
4503 throw INTERP_KERNEL::Exception(msg2);
4504 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4505 self->getArray()->divideEqual(aaa);
4506 Py_XINCREF(trueSelf);
4510 { throw INTERP_KERNEL::Exception(msg); }
4514 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4516 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.";
4517 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4520 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4522 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4526 Py_XINCREF(trueSelf);
4530 throw INTERP_KERNEL::Exception(msg);
4535 DataArrayDoubleTuple *aa;
4536 std::vector<double> bb;
4538 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4543 if(!self->getArray())
4544 throw INTERP_KERNEL::Exception(msg2);
4545 self->getArray()->applyPow(val);
4546 Py_XINCREF(trueSelf);
4551 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4554 Py_XINCREF(trueSelf);
4559 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4560 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4561 ret2->setArray(aaa);
4563 Py_XINCREF(trueSelf);
4568 if(!self->getArray())
4569 throw INTERP_KERNEL::Exception(msg2);
4570 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4571 self->getArray()->powEqual(aaa);
4572 Py_XINCREF(trueSelf);
4576 { throw INTERP_KERNEL::Exception(msg); }
4580 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4582 std::vector<const MEDCouplingFieldDouble *> tmp;
4583 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4584 return MEDCouplingFieldDouble::MergeFields(tmp);
4587 static void WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
4589 std::vector<const MEDCouplingFieldDouble *> tmp;
4590 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4591 MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4596 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4599 int getNumberOfFields() const;
4600 MEDCouplingMultiFields *deepCpy() const;
4601 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4602 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4603 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4604 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4605 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4608 std::string __str__() const throw(INTERP_KERNEL::Exception)
4610 return self->simpleRepr();
4612 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4614 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4615 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4617 std::vector<MEDCouplingFieldDouble *> fs(sz);
4618 for(int i=0;i<sz;i++)
4619 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4620 return MEDCouplingMultiFields::New(fs);
4622 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4624 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4625 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4627 std::vector<MEDCouplingFieldDouble *> fs(sz);
4628 for(int i=0;i<sz;i++)
4629 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4630 return MEDCouplingMultiFields::New(fs);
4632 PyObject *getFields() const
4634 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4635 int sz=fields.size();
4636 PyObject *res = PyList_New(sz);
4637 for(int i=0;i<sz;i++)
4641 fields[i]->incrRef();
4642 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4646 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4651 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4653 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4657 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4660 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4662 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4664 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4666 PyObject *res = PyList_New(sz);
4667 for(int i=0;i<sz;i++)
4672 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4676 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4681 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4683 std::vector<int> refs;
4684 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4686 PyObject *res = PyList_New(sz);
4687 for(int i=0;i<sz;i++)
4692 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4696 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4700 PyObject *ret=PyTuple_New(2);
4701 PyTuple_SetItem(ret,0,res);
4702 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4705 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4707 std::vector<DataArrayDouble *> ms=self->getArrays();
4709 PyObject *res = PyList_New(sz);
4710 for(int i=0;i<sz;i++)
4715 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4719 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4724 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4726 std::vector< std::vector<int> > refs;
4727 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4729 PyObject *res = PyList_New(sz);
4730 PyObject *res2 = PyList_New(sz);
4731 for(int i=0;i<sz;i++)
4736 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4740 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4742 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4745 PyObject *ret=PyTuple_New(2);
4746 PyTuple_SetItem(ret,0,res);
4747 PyTuple_SetItem(ret,1,res2);
4753 class MEDCouplingDefinitionTime
4756 MEDCouplingDefinitionTime();
4757 void assign(const MEDCouplingDefinitionTime& other);
4758 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4759 double getTimeResolution() const;
4760 std::vector<double> getHotSpotsTime() const;
4763 std::string __str__() const throw(INTERP_KERNEL::Exception)
4765 std::ostringstream oss;
4766 self->appendRepr(oss);
4770 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4772 int meshId,arrId,arrIdInField,fieldId;
4773 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4774 PyObject *res=PyList_New(4);
4775 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4776 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4777 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4778 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4782 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4784 int meshId,arrId,arrIdInField,fieldId;
4785 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4786 PyObject *res=PyList_New(4);
4787 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4788 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4789 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4790 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4796 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4799 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4800 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4804 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4806 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4807 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4809 std::vector<MEDCouplingFieldDouble *> fs(sz);
4810 for(int i=0;i<sz;i++)
4811 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4812 return MEDCouplingFieldOverTime::New(fs);
4814 std::string __str__() const throw(INTERP_KERNEL::Exception)
4816 return self->simpleRepr();
4818 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4820 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4821 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4823 std::vector<MEDCouplingFieldDouble *> fs(sz);
4824 for(int i=0;i<sz;i++)
4825 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4826 return MEDCouplingFieldOverTime::New(fs);
4831 class MEDCouplingCartesianAMRMesh;
4833 class MEDCouplingCartesianAMRPatchGen : public RefCountObject
4836 int getNumberOfCellsRecursiveWithOverlap() const throw(INTERP_KERNEL::Exception);
4837 int getNumberOfCellsRecursiveWithoutOverlap() const throw(INTERP_KERNEL::Exception);
4838 int getMaxNumberOfLevelsRelativeToThis() const throw(INTERP_KERNEL::Exception);
4841 MEDCouplingCartesianAMRMeshGen *getMesh() const throw(INTERP_KERNEL::Exception)
4843 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
4851 class MEDCouplingCartesianAMRPatch : public MEDCouplingCartesianAMRPatchGen
4854 int getNumberOfOverlapedCellsForFather() const throw(INTERP_KERNEL::Exception);
4855 bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const throw(INTERP_KERNEL::Exception);
4856 std::vector<int> computeCellGridSt() const throw(INTERP_KERNEL::Exception);
4859 PyObject *getBLTRRange() const throw(INTERP_KERNEL::Exception)
4861 const std::vector< std::pair<int,int> >& ret(self->getBLTRRange());
4862 return convertFromVectorPairInt(ret);
4865 void addPatch(PyObject *bottomLeftTopRight, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception)
4867 std::vector< std::pair<int,int> > inp;
4868 convertPyToVectorPairInt(bottomLeftTopRight,inp);
4869 self->addPatch(inp,factors);
4872 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const throw(INTERP_KERNEL::Exception)
4874 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
4876 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatchGen.__getitem__ : no underlying mesh !");
4877 if(patchId==mesh->getNumberOfPatches())
4879 std::ostringstream oss;
4880 oss << "Requesting for patchId " << patchId << " having only " << mesh->getNumberOfPatches() << " patches !";
4881 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4884 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(mesh->getPatch(patchId)));
4890 void __delitem__(int patchId) throw(INTERP_KERNEL::Exception)
4892 MEDCouplingCartesianAMRMeshGen *mesh(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
4894 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__delitem__ : no underlying mesh !");
4895 mesh->removePatch(patchId);
4898 int __len__() const throw(INTERP_KERNEL::Exception)
4900 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
4902 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__len__ : no underlying mesh !");
4903 return mesh->getNumberOfPatches();
4908 class MEDCouplingCartesianAMRPatchGF : public MEDCouplingCartesianAMRPatchGen
4912 class MEDCouplingDataForGodFather : public RefCountObject
4915 virtual void synchronizeFineToCoarse() throw(INTERP_KERNEL::Exception);
4916 virtual void synchronizeCoarseToFine() throw(INTERP_KERNEL::Exception);
4917 virtual void synchronizeAllGhostZones() throw(INTERP_KERNEL::Exception);
4918 virtual void alloc() throw(INTERP_KERNEL::Exception);
4919 virtual void dealloc() throw(INTERP_KERNEL::Exception);
4922 class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel
4925 int getAbsoluteLevel() const throw(INTERP_KERNEL::Exception);
4926 int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
4927 const std::vector<int>& getFactors() const throw(INTERP_KERNEL::Exception);
4928 void setFactors(const std::vector<int>& newFactors) throw(INTERP_KERNEL::Exception);
4929 int getMaxNumberOfLevelsRelativeToThis() const throw(INTERP_KERNEL::Exception);
4930 int getNumberOfCellsAtCurrentLevel() const throw(INTERP_KERNEL::Exception);
4931 int getNumberOfCellsAtCurrentLevelGhost(int ghostLev) const throw(INTERP_KERNEL::Exception);
4932 int getNumberOfCellsRecursiveWithOverlap() const throw(INTERP_KERNEL::Exception);
4933 int getNumberOfCellsRecursiveWithoutOverlap() const throw(INTERP_KERNEL::Exception);
4934 bool isPatchInNeighborhoodOf(int patchId1, int patchId2, int ghostLev) const throw(INTERP_KERNEL::Exception);
4936 int getNumberOfPatches() const throw(INTERP_KERNEL::Exception);
4937 int getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const throw(INTERP_KERNEL::Exception);
4938 MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
4939 DataArrayDouble *extractGhostFrom(int ghostSz, const DataArrayDouble *arr) const throw(INTERP_KERNEL::Exception);
4940 std::vector<int> getPatchIdsInTheNeighborhoodOf(int patchId, int ghostLev) const throw(INTERP_KERNEL::Exception);
4941 MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const throw(INTERP_KERNEL::Exception);
4942 MEDCoupling1SGTUMesh *buildMeshOfDirectChildrenOnly() const throw(INTERP_KERNEL::Exception);
4943 void removeAllPatches() throw(INTERP_KERNEL::Exception);
4944 void removePatch(int patchId) throw(INTERP_KERNEL::Exception);
4945 void detachFromFather() throw(INTERP_KERNEL::Exception);
4946 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception);
4947 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector<int>& factors, double eps) throw(INTERP_KERNEL::Exception);
4948 DataArrayDouble *createCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis) const throw(INTERP_KERNEL::Exception);
4949 void fillCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const throw(INTERP_KERNEL::Exception);
4950 void fillCellFieldOnPatchGhost(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev, bool isConservative=true) const throw(INTERP_KERNEL::Exception);
4951 void fillCellFieldOnPatchOnlyOnGhostZone(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev) const throw(INTERP_KERNEL::Exception);
4952 void fillCellFieldOnPatchOnlyOnGhostZoneWith(int ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const;
4953 void fillCellFieldComingFromPatch(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const throw(INTERP_KERNEL::Exception);
4954 void fillCellFieldComingFromPatchGhost(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, int ghostLev, bool isConservative=true) const throw(INTERP_KERNEL::Exception);
4955 DataArrayInt *findPatchesInTheNeighborhoodOf(int patchId, int ghostLev) const throw(INTERP_KERNEL::Exception);
4958 void addPatch(PyObject *bottomLeftTopRight, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception)
4960 std::vector< std::pair<int,int> > inp;
4961 convertPyToVectorPairInt(bottomLeftTopRight,inp);
4962 self->addPatch(inp,factors);
4965 PyObject *getPatches() const throw(INTERP_KERNEL::Exception)
4967 std::vector< const MEDCouplingCartesianAMRPatch *> ps(self->getPatches());
4969 PyObject *ret = PyList_New(sz);
4970 for(int i=0;i<sz;i++)
4972 MEDCouplingCartesianAMRPatch *elt(const_cast<MEDCouplingCartesianAMRPatch *>(ps[i]));
4975 PyList_SetItem(ret,i,convertCartesianAMRPatch(elt, SWIG_POINTER_OWN | 0 ));
4980 void createPatchesFromCriterionML(PyObject *bso, const DataArrayDouble *criterion, PyObject *factors, double eps) throw(INTERP_KERNEL::Exception)
4982 std::vector<const INTERP_KERNEL::BoxSplittingOptions *> inp0;
4983 convertFromPyObjVectorOfObj<const INTERP_KERNEL::BoxSplittingOptions *>(bso,SWIGTYPE_p_INTERP_KERNEL__BoxSplittingOptions,"BoxSplittingOptions",inp0);
4984 std::vector< std::vector<int> > inp2;
4985 convertPyToVectorOfVectorOfInt(factors,inp2);
4986 self->createPatchesFromCriterionML(inp0,criterion,inp2,eps);
4989 PyObject *retrieveGridsAt(int absoluteLev) const throw(INTERP_KERNEL::Exception)
4991 std::vector<MEDCouplingCartesianAMRPatchGen *> ps(self->retrieveGridsAt(absoluteLev));
4993 PyObject *ret = PyList_New(sz);
4994 for(int i=0;i<sz;i++)
4995 PyList_SetItem(ret,i,convertCartesianAMRPatch(ps[i], SWIG_POINTER_OWN | 0 ));
4999 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(int ghostSz, PyObject *recurseArrs) const
5001 std::vector<const DataArrayDouble *> inp;
5002 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayDouble *>(recurseArrs,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",inp);
5003 return self->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostSz,inp);
5006 MEDCouplingCartesianAMRMeshGen *getFather() const throw(INTERP_KERNEL::Exception)
5008 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getFather()));
5014 MEDCouplingCartesianAMRMeshGen *getGodFather() const throw(INTERP_KERNEL::Exception)
5016 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getGodFather()));
5022 MEDCouplingCartesianAMRPatch *getPatch(int patchId) const throw(INTERP_KERNEL::Exception)
5024 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5030 MEDCouplingIMesh *getImageMesh() const throw(INTERP_KERNEL::Exception)
5032 const MEDCouplingIMesh *ret(self->getImageMesh());
5035 return const_cast<MEDCouplingIMesh *>(ret);
5038 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const throw(INTERP_KERNEL::Exception)
5040 if(patchId==self->getNumberOfPatches())
5042 std::ostringstream oss;
5043 oss << "Requesting for patchId " << patchId << " having only " << self->getNumberOfPatches() << " patches !";
5044 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5047 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5053 void fillCellFieldOnPatchGhostAdv(int patchId, const DataArrayDouble *cellFieldOnThis, int ghostLev, PyObject *arrsOnPatches, bool isConservative=true) const throw(INTERP_KERNEL::Exception)
5055 std::vector<const ParaMEDMEM::DataArrayDouble *> arrsOnPatches2;
5056 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5057 self->fillCellFieldOnPatchGhostAdv(patchId,cellFieldOnThis,ghostLev,arrsOnPatches2,isConservative);
5060 void fillCellFieldOnPatchOnlyGhostAdv(int patchId, int ghostLev, PyObject *arrsOnPatches) const
5062 std::vector<const ParaMEDMEM::DataArrayDouble *> arrsOnPatches2;
5063 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5064 self->fillCellFieldOnPatchOnlyGhostAdv(patchId,ghostLev,arrsOnPatches2);
5067 void __delitem__(int patchId) throw(INTERP_KERNEL::Exception)
5069 self->removePatch(patchId);
5072 int __len__() const throw(INTERP_KERNEL::Exception)
5074 return self->getNumberOfPatches();
5079 class MEDCouplingCartesianAMRMeshSub : public MEDCouplingCartesianAMRMeshGen
5083 class MEDCouplingCartesianAMRMesh : public MEDCouplingCartesianAMRMeshGen
5088 static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
5090 static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !";
5091 static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !";
5092 const int *nodeStrctPtr(0);
5093 const double *originPtr(0),*dxyzPtr(0);
5095 std::vector<int> bb0;
5096 nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
5099 std::vector<double> bb,bb2;
5101 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
5102 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
5104 return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
5107 MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
5109 return ParaMEDMEM_MEDCouplingCartesianAMRMesh_New(meshName,spaceDim,nodeStrct,origin,dxyz);
5114 class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel
5117 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception);
5118 MEDCouplingFieldDouble *buildCellFieldOnWithGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception);
5119 MEDCouplingFieldDouble *buildCellFieldOnWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception);
5120 bool changeGodFather(MEDCouplingCartesianAMRMesh *gf) throw(INTERP_KERNEL::Exception);
5123 static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, int ghostLev) throw(INTERP_KERNEL::Exception)
5125 std::vector< std::pair<std::string,int> > fieldNamesCpp0;
5126 std::vector< std::pair<std::string, std::vector<std::string> > > fieldNamesCpp1;
5127 MEDCouplingAMRAttribute *ret(0);
5130 convertPyToVectorPairStringInt(fieldNames,fieldNamesCpp0);
5131 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp0,ghostLev);
5133 catch(INTERP_KERNEL::Exception&)
5135 convertPyToVectorPairStringVecString(fieldNames,fieldNamesCpp1);
5136 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp1,ghostLev);
5141 MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, int ghostLev) throw(INTERP_KERNEL::Exception)
5143 return ParaMEDMEM_MEDCouplingAMRAttribute_New(gf,fieldNames,ghostLev);
5146 DataArrayDouble *getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception)
5148 const DataArrayDouble *ret(self->getFieldOn(mesh,fieldName));
5149 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
5155 void spillInfoOnComponents(PyObject *compNames) throw(INTERP_KERNEL::Exception)
5157 std::vector< std::vector<std::string> > compNamesCpp;
5158 convertPyToVectorOfVectorOfString(compNames,compNamesCpp);
5159 self->spillInfoOnComponents(compNamesCpp);
5162 void spillNatures(PyObject *nfs) throw(INTERP_KERNEL::Exception)
5164 std::vector<int> inp0;
5165 if(!fillIntVector(nfs,inp0))
5166 throw INTERP_KERNEL::Exception("wrap of MEDCouplingAMRAttribute::spillNatures : vector of NatureOfField enum expected !");
5167 std::size_t sz(inp0.size());
5168 std::vector<NatureOfField> inp00(sz);
5169 for(std::size_t i=0;i<sz;i++)
5170 inp00[i]=(NatureOfField)inp0[i];
5171 self->spillNatures(inp00);
5174 PyObject *retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const throw(INTERP_KERNEL::Exception)
5176 std::vector<DataArrayDouble *> ret(self->retrieveFieldsOn(mesh));
5177 int sz((int)ret.size());
5178 PyObject *retPy(PyList_New(sz));
5179 for(int i=0;i<sz;i++)
5180 PyList_SetItem(retPy,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5186 class DenseMatrix : public RefCountObject, public TimeLabel
5189 static DenseMatrix *New(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
5190 static DenseMatrix *New(DataArrayDouble *array, int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
5191 DenseMatrix *deepCpy() const throw(INTERP_KERNEL::Exception);
5192 DenseMatrix *shallowCpy() const throw(INTERP_KERNEL::Exception);
5194 int getNumberOfRows() const throw(INTERP_KERNEL::Exception);
5195 int getNumberOfCols() const throw(INTERP_KERNEL::Exception);
5196 int getNbOfElems() const throw(INTERP_KERNEL::Exception);
5197 void reBuild(DataArrayDouble *array, int nbRows=-1, int nbCols=-1) throw(INTERP_KERNEL::Exception);
5198 void reShape(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
5199 void transpose() throw(INTERP_KERNEL::Exception);
5201 bool isEqual(const DenseMatrix& other, double eps) const throw(INTERP_KERNEL::Exception);
5202 DataArrayDouble *matVecMult(const DataArrayDouble *vec) const throw(INTERP_KERNEL::Exception);
5203 static DataArrayDouble *MatVecMult(const DenseMatrix *mat, const DataArrayDouble *vec) throw(INTERP_KERNEL::Exception);
5206 DenseMatrix(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception)
5208 return DenseMatrix::New(nbRows,nbCols);
5211 DenseMatrix(DataArrayDouble *array, int nbRows, int nbCols) throw(INTERP_KERNEL::Exception)
5213 return DenseMatrix::New(array,nbRows,nbCols);
5216 PyObject *isEqualIfNotWhy(const DenseMatrix& other, double eps) const throw(INTERP_KERNEL::Exception)
5219 bool ret0=self->isEqualIfNotWhy(other,eps,ret1);
5220 PyObject *ret=PyTuple_New(2);
5221 PyObject *ret0Py=ret0?Py_True:Py_False;
5223 PyTuple_SetItem(ret,0,ret0Py);
5224 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5228 DataArrayDouble *getData() throw(INTERP_KERNEL::Exception)
5230 DataArrayDouble *ret(self->getData());
5236 DenseMatrix *__add__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5238 return ParaMEDMEM::DenseMatrix::Add(self,other);
5241 DenseMatrix *__sub__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5243 return ParaMEDMEM::DenseMatrix::Substract(self,other);
5246 DenseMatrix *__mul__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5248 return ParaMEDMEM::DenseMatrix::Multiply(self,other);
5251 DenseMatrix *__mul__(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception)
5253 return ParaMEDMEM::DenseMatrix::Multiply(self,other);
5256 PyObject *___iadd___(PyObject *trueSelf, const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5258 self->addEqual(other);
5259 Py_XINCREF(trueSelf);
5263 PyObject *___isub___(PyObject *trueSelf, const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5265 self->substractEqual(other);
5266 Py_XINCREF(trueSelf);
5270 PyObject *toNumPyMatrix() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5272 PyObject *obj(ToNumPyArrayUnderground<DataArrayDouble,double>(self->getData(),NPY_DOUBLE,"DataArrayDouble",self->getNumberOfRows(),self->getNumberOfCols()));
5282 __filename=os.environ.get('PYTHONSTARTUP')
5283 if __filename and os.path.isfile(__filename):
5284 execfile(__filename)