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::MEDCouplingCMesh::New;
328 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
329 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
330 %newobject ParaMEDMEM::MEDCouplingIMesh::New;
331 %newobject ParaMEDMEM::MEDCouplingIMesh::asSingleCell;
332 %newobject ParaMEDMEM::MEDCouplingIMesh::buildWithGhost;
333 %newobject ParaMEDMEM::MEDCouplingIMesh::convertToCartesian;
334 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
335 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
336 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
337 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
338 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
339 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
340 %newobject ParaMEDMEM::MEDCouplingCartesianAMRPatchGen::getMesh;
341 %newobject ParaMEDMEM::MEDCouplingCartesianAMRPatchGen::__getitem__;
342 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::buildUnstructured;
343 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::extractGhostFrom;
344 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::buildMeshFromPatchEnvelop;
345 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::buildMeshOfDirectChildrenOnly;
346 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getImageMesh;
347 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getGodFather;
348 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getFather;
349 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getPatch;
350 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::createCellFieldOnPatch;
351 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::findPatchesInTheNeighborhoodOf;
352 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::__getitem__;
353 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::New;
354 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::New;
355 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::getFieldOn;
356 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::buildCellFieldOnRecurseWithoutOverlapWithoutGhost;
357 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::buildCellFieldOnWithGhost;
358 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost;
359 %newobject ParaMEDMEM::DenseMatrix::New;
360 %newobject ParaMEDMEM::DenseMatrix::deepCpy;
361 %newobject ParaMEDMEM::DenseMatrix::shallowCpy;
362 %newobject ParaMEDMEM::DenseMatrix::getData;
363 %newobject ParaMEDMEM::DenseMatrix::matVecMult;
364 %newobject ParaMEDMEM::DenseMatrix::MatVecMult;
365 %newobject ParaMEDMEM::DenseMatrix::__add__;
366 %newobject ParaMEDMEM::DenseMatrix::__sub__;
367 %newobject ParaMEDMEM::DenseMatrix::__mul__;
369 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
370 %feature("unref") MEDCouplingMesh "$this->decrRef();"
371 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
372 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
373 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
374 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
375 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
376 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
377 %feature("unref") MEDCouplingIMesh "$this->decrRef();"
378 %feature("unref") MEDCouplingCurveLinearMesh "$this->decrRef();"
379 %feature("unref") MEDCouplingField "$this->decrRef();"
380 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
381 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
382 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
383 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
384 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
385 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
386 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
387 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
388 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
389 %feature("unref") MEDCouplingCartesianAMRMeshGen "$this->decrRef();"
390 %feature("unref") MEDCouplingCartesianAMRMesh "$this->decrRef();"
391 %feature("unref") MEDCouplingCartesianAMRMeshSub "$this->decrRef();"
392 %feature("unref") MEDCouplingCartesianAMRPatchGen "$this->decrRef();"
393 %feature("unref") MEDCouplingCartesianAMRPatchGF "$this->decrRef();"
394 %feature("unref") MEDCouplingCartesianAMRPatch "$this->decrRef();"
395 %feature("unref") MEDCouplingDataForGodFather "$this->decrRef();"
396 %feature("unref") MEDCouplingAMRAttribute "$this->decrRef();"
397 %feature("unref") DenseMatrix "$this->decrRef();"
399 %rename(assign) *::operator=;
400 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
401 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
402 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
403 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
407 %rename (InterpKernelException) INTERP_KERNEL::Exception;
409 %include "MEDCouplingRefCountObject.i"
410 %include "MEDCouplingMemArray.i"
412 namespace INTERP_KERNEL
415 * \class BoxSplittingOptions
416 * Class defining the options for box splitting used for AMR algorithm like creation of patches following a criterion.
418 class BoxSplittingOptions
421 BoxSplittingOptions();
422 void init() throw(INTERP_KERNEL::Exception);
423 double getEffeciency() const throw(INTERP_KERNEL::Exception);
424 void setEffeciency(double effeciency) throw(INTERP_KERNEL::Exception);
425 double getEffeciencySnd() const throw(INTERP_KERNEL::Exception);
426 void setEffeciencySnd(double effeciencySnd) throw(INTERP_KERNEL::Exception);
427 int getMinCellDirection() const throw(INTERP_KERNEL::Exception);
428 void setMinCellDirection(int minCellDirection) throw(INTERP_KERNEL::Exception);
429 int getMaxCells() const throw(INTERP_KERNEL::Exception);
430 void setMaxCells(int maxCells) throw(INTERP_KERNEL::Exception);
431 void copyOptions(const BoxSplittingOptions & other) throw(INTERP_KERNEL::Exception);
432 std::string printOptions() const throw(INTERP_KERNEL::Exception);
435 std::string __str__() const throw(INTERP_KERNEL::Exception)
437 return self->printOptions();
459 CONST_ON_TIME_INTERVAL = 7
460 } TypeOfTimeDiscretization;
468 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
469 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
471 } MEDCouplingMeshType;
474 class DataArrayDouble;
475 class MEDCouplingUMesh;
476 class MEDCouplingFieldDouble;
478 %extend RefCountObject
480 std::string getHiddenCppPointer() const
482 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
487 %extend MEDCouplingGaussLocalization
489 std::string __str__() const throw(INTERP_KERNEL::Exception)
491 return self->getStringRepr();
494 std::string __repr__() const throw(INTERP_KERNEL::Exception)
496 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
497 oss << self->getStringRepr();
504 class MEDCouplingMesh : public RefCountObject, public TimeLabel
507 void setName(const std::string& name);
508 std::string getName() const;
509 void setDescription(const std::string& descr);
510 std::string getDescription() const;
511 void setTime(double val, int iteration, int order);
512 void setTimeUnit(const std::string& unit);
513 std::string getTimeUnit() const;
514 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
515 bool isStructured() const throw(INTERP_KERNEL::Exception);
516 virtual MEDCouplingMesh *deepCpy() const;
517 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
518 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
519 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
520 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
521 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
522 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
523 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
524 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
525 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
526 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
527 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
528 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
529 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
530 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
531 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
532 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
533 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
534 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
535 virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
536 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
537 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
538 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
539 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
540 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
541 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
543 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
544 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
545 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
546 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
547 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception);
548 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
549 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
550 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
551 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
552 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
553 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
554 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
555 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
556 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
557 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
558 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
559 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
562 std::string __str__() const throw(INTERP_KERNEL::Exception)
564 return self->simpleRepr();
567 PyObject *getTime() throw(INTERP_KERNEL::Exception)
570 double tmp0=self->getTime(tmp1,tmp2);
571 PyObject *res = PyList_New(3);
572 PyList_SetItem(res,0,SWIG_From_double(tmp0));
573 PyList_SetItem(res,1,SWIG_From_int(tmp1));
574 PyList_SetItem(res,2,SWIG_From_int(tmp2));
578 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
582 DataArrayDoubleTuple *aa;
583 std::vector<double> bb;
585 int spaceDim=self->getSpaceDimension();
586 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
587 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
588 return self->getCellContainingPoint(pos,eps);
591 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
595 DataArrayDoubleTuple *aa;
596 std::vector<double> bb;
598 int spaceDim=self->getSpaceDimension();
599 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
600 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
601 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
602 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
603 PyObject *ret=PyTuple_New(2);
604 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
605 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
609 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
611 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
612 int spaceDim=self->getSpaceDimension();
614 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
615 if (!SWIG_IsOK(res1))
618 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
619 int nbOfPoints=size/spaceDim;
622 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
624 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
628 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
630 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
631 da2->checkAllocated();
632 int size=da2->getNumberOfTuples();
633 int nbOfCompo=da2->getNumberOfComponents();
634 if(nbOfCompo!=spaceDim)
636 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
638 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
640 PyObject *ret=PyTuple_New(2);
641 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
642 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
646 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
650 DataArrayDoubleTuple *aa;
651 std::vector<double> bb;
653 int spaceDim=self->getSpaceDimension();
654 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
655 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
656 std::vector<int> elts;
657 self->getCellsContainingPoint(pos,eps,elts);
658 DataArrayInt *ret=DataArrayInt::New();
659 ret->alloc((int)elts.size(),1);
660 std::copy(elts.begin(),elts.end(),ret->getPointer());
661 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
664 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
666 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
667 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
668 self->getReverseNodalConnectivity(d0,d1);
669 PyObject *ret=PyTuple_New(2);
670 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
671 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
675 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
678 int v0; std::vector<int> v1;
679 const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
680 self->renumberCells(ids,check);
683 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
685 DataArrayInt *cellCor, *nodeCor;
686 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
687 PyObject *res = PyList_New(2);
688 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
689 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
693 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
695 DataArrayInt *cellCor=0,*nodeCor=0;
696 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
697 PyObject *res = PyList_New(2);
698 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
699 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
703 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
705 DataArrayInt *cellCor=0;
706 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
710 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
713 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
714 if (!SWIG_IsOK(res1))
717 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
718 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
722 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
724 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
725 da2->checkAllocated();
726 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
729 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
731 std::vector<int> conn;
732 self->getNodeIdsOfCell(cellId,conn);
733 return convertIntArrToPyList2(conn);
736 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
738 std::vector<double> coo;
739 self->getCoordinatesOfNode(nodeId,coo);
740 return convertDblArrToPyList2(coo);
743 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
747 DataArrayDoubleTuple *aa;
748 std::vector<double> bb;
750 int spaceDim=self->getSpaceDimension();
751 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
752 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
753 self->scale(pointPtr,factor);
756 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
758 int spaceDim=self->getSpaceDimension();
759 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
760 self->getBoundingBox(tmp);
761 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
765 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
768 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
769 PyObject *ret=PyTuple_New(2);
770 PyObject *ret0Py=ret0?Py_True:Py_False;
772 PyTuple_SetItem(ret,0,ret0Py);
773 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
777 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
779 int szArr,sw,iTypppArr;
780 std::vector<int> stdvecTyyppArr;
781 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
782 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
783 if(sw==3)//DataArrayInt
785 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
786 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
787 std::string name=argpt->getName();
789 ret->setName(name.c_str());
791 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
794 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
796 int szArr,sw,iTypppArr;
797 std::vector<int> stdvecTyyppArr;
799 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
800 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
801 if(sw==3)//DataArrayInt
803 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
804 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
805 std::string name=argpt->getName();
807 ret->setName(name.c_str());
810 PyObject *res = PyList_New(2);
811 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
812 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
813 PyList_SetItem(res,0,obj0);
814 PyList_SetItem(res,1,obj1);
818 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
822 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
823 PyObject *res = PyTuple_New(2);
824 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
827 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
829 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
830 PyTuple_SetItem(res,0,obj0);
831 PyTuple_SetItem(res,1,obj1);
835 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
837 std::vector<int> vals=self->getDistributionOfTypes();
839 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
840 PyObject *ret=PyList_New((int)vals.size()/3);
841 for(int j=0;j<(int)vals.size()/3;j++)
843 PyObject *ret1=PyList_New(3);
844 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
845 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
846 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
847 PyList_SetItem(ret,j,ret1);
852 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
854 std::vector<int> code;
855 std::vector<const DataArrayInt *> idsPerType;
856 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
857 convertPyToNewIntArr4(li,1,3,code);
858 return self->checkTypeConsistencyAndContig(code,idsPerType);
861 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
863 std::vector<int> code;
864 std::vector<DataArrayInt *> idsInPflPerType;
865 std::vector<DataArrayInt *> idsPerType;
866 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
867 PyObject *ret=PyTuple_New(3);
870 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
871 PyObject *ret0=PyList_New((int)code.size()/3);
872 for(int j=0;j<(int)code.size()/3;j++)
874 PyObject *ret00=PyList_New(3);
875 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
876 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
877 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
878 PyList_SetItem(ret0,j,ret00);
880 PyTuple_SetItem(ret,0,ret0);
882 PyObject *ret1=PyList_New(idsInPflPerType.size());
883 for(std::size_t j=0;j<idsInPflPerType.size();j++)
884 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
885 PyTuple_SetItem(ret,1,ret1);
886 int n=idsPerType.size();
887 PyObject *ret2=PyList_New(n);
889 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
890 PyTuple_SetItem(ret,2,ret2);
894 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
898 DataArrayDoubleTuple *aa;
899 std::vector<double> bb;
901 int spaceDim=self->getSpaceDimension();
902 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
903 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
904 self->translate(vectorPtr);
907 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
909 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
912 DataArrayDoubleTuple *aa;
913 std::vector<double> bb;
915 int spaceDim=self->getSpaceDimension();
916 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
917 self->rotate(centerPtr,0,alpha);
920 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
922 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
924 DataArrayDouble *a,*a2;
925 DataArrayDoubleTuple *aa,*aa2;
926 std::vector<double> bb,bb2;
928 int spaceDim=self->getSpaceDimension();
929 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
930 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
931 self->rotate(centerPtr,vectorPtr,alpha);
934 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
936 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
937 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
938 PyObject *res=PyList_New(result.size());
939 for(int i=0;iL!=result.end(); i++, iL++)
940 PyList_SetItem(res,i,PyInt_FromLong(*iL));
944 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
946 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
947 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
948 return MEDCouplingMesh::MergeMeshes(tmp);
954 //== MEDCouplingMesh End
956 %include "NormalizedGeometricTypes"
957 %include "MEDCouplingNatureOfFieldEnum"
961 class MEDCouplingNatureOfField
964 static const char *GetRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception);
965 static std::string GetReprNoThrow(NatureOfField nat);
966 static std::string GetAllPossibilitiesStr();
970 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
971 // include "MEDCouplingTimeDiscretization.i"
975 class MEDCouplingGaussLocalization
978 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
979 const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
980 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
981 INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
982 void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
983 int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
984 int getDimension() const throw(INTERP_KERNEL::Exception);
985 int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
986 std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
987 void checkCoherency() const throw(INTERP_KERNEL::Exception);
988 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception);
990 const std::vector<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
991 double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
992 const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
993 double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
994 const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
995 double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
996 void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
997 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
998 void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
999 void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
1000 void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
1001 void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
1003 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
1007 %include "MEDCouplingFieldDiscretization.i"
1009 //== MEDCouplingPointSet
1011 namespace ParaMEDMEM
1013 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
1016 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
1017 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
1018 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
1019 void zipCoords() throw(INTERP_KERNEL::Exception);
1020 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
1021 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
1022 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
1023 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
1024 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
1025 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
1026 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
1027 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
1028 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
1029 static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception);
1030 virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
1031 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
1032 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
1033 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
1034 virtual DataArrayInt *findBoundaryNodes() const;
1035 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
1036 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
1037 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
1038 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
1039 virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
1040 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1043 std::string __str__() const throw(INTERP_KERNEL::Exception)
1045 return self->simpleRepr();
1048 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
1051 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1052 PyObject *res = PyList_New(2);
1053 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1054 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
1058 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
1060 DataArrayInt *comm, *commIndex;
1061 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1062 PyObject *res = PyList_New(2);
1063 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1064 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1068 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
1070 DataArrayDouble *ret1=self->getCoords();
1073 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
1076 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
1078 int szArr,sw,iTypppArr;
1079 std::vector<int> stdvecTyyppArr;
1080 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1081 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1082 if(sw==3)//DataArrayInt
1084 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1085 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1086 std::string name=argpt->getName();
1088 ret->setName(name.c_str());
1090 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1093 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1095 int szArr,sw,iTypppArr;
1096 std::vector<int> stdvecTyyppArr;
1097 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1098 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1099 if(sw==3)//DataArrayInt
1101 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1102 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1103 std::string name=argpt->getName();
1105 ret->setName(name.c_str());
1107 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1110 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
1112 int szArr,sw,iTypppArr;
1113 std::vector<int> stdvecTyyppArr;
1114 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1115 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1116 if(sw==3)//DataArrayInt
1118 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1119 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1120 std::string name=argpt->getName();
1122 ret->setName(name.c_str());
1124 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1127 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1129 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1130 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1133 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1135 int szArr,sw,iTypppArr;
1136 std::vector<int> stdvecTyyppArr;
1137 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1138 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1139 if(sw==3)//DataArrayInt
1141 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1142 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1143 std::string name=argpt->getName();
1145 ret->setName(name.c_str());
1147 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1150 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1152 int szArr,sw,iTypppArr;
1153 std::vector<int> stdvecTyyppArr;
1154 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1155 self->renumberNodes(tmp,newNbOfNodes);
1158 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1160 int szArr,sw,iTypppArr;
1161 std::vector<int> stdvecTyyppArr;
1162 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1163 self->renumberNodes2(tmp,newNbOfNodes);
1166 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1168 int spaceDim=self->getSpaceDimension();
1170 DataArrayDouble *a,*a2;
1171 DataArrayDoubleTuple *aa,*aa2;
1172 std::vector<double> bb,bb2;
1174 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1175 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1176 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1177 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1178 std::vector<int> nodes;
1179 self->findNodesOnLine(p,v,eps,nodes);
1180 DataArrayInt *ret=DataArrayInt::New();
1181 ret->alloc((int)nodes.size(),1);
1182 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1183 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1185 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1187 int spaceDim=self->getSpaceDimension();
1189 DataArrayDouble *a,*a2;
1190 DataArrayDoubleTuple *aa,*aa2;
1191 std::vector<double> bb,bb2;
1193 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1194 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1195 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1196 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1197 std::vector<int> nodes;
1198 self->findNodesOnPlane(p,v,eps,nodes);
1199 DataArrayInt *ret=DataArrayInt::New();
1200 ret->alloc((int)nodes.size(),1);
1201 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1202 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1205 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1209 DataArrayDoubleTuple *aa;
1210 std::vector<double> bb;
1212 int spaceDim=self->getSpaceDimension();
1213 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1214 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1215 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1216 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1219 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1221 DataArrayInt *c=0,*cI=0;
1225 DataArrayDoubleTuple *aa;
1226 std::vector<double> bb;
1228 int spaceDim=self->getSpaceDimension();
1229 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1230 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1231 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1232 PyObject *ret=PyTuple_New(2);
1233 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1234 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1238 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1240 DataArrayInt *c=0,*cI=0;
1241 int spaceDim=self->getSpaceDimension();
1244 DataArrayDoubleTuple *aa;
1245 std::vector<double> bb;
1248 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1249 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1251 PyObject *ret=PyTuple_New(2);
1252 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1253 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1257 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1261 DataArrayDoubleTuple *aa;
1262 std::vector<double> bb;
1264 int spaceDim=self->getSpaceDimension();
1265 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1266 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1268 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1269 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1272 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1276 std::vector<int> multiVal;
1277 std::pair<int, std::pair<int,int> > slic;
1278 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1279 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1283 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1285 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1287 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1289 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1293 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1295 DataArrayInt *v0=0,*v1=0;
1296 self->findCommonCells(compType,startCellId,v0,v1);
1297 PyObject *res = PyList_New(2);
1298 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1299 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1304 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1307 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1308 if (!SWIG_IsOK(res1))
1311 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1312 self->renumberNodesInConn(tmp);
1316 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1318 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1319 da2->checkAllocated();
1320 self->renumberNodesInConn(da2->getConstPointer());
1324 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1327 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1328 PyObject *ret=PyTuple_New(2);
1329 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1330 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1334 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1336 DataArrayInt *ret=0;
1338 int szArr,sw,iTypppArr;
1339 std::vector<int> stdvecTyyppArr;
1340 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1341 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1345 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1349 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1350 PyObject *res = PyList_New(3);
1351 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1352 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1353 PyList_SetItem(res,2,SWIG_From_int(ret2));
1357 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1361 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1362 PyObject *res = PyList_New(3);
1363 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1364 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1365 PyList_SetItem(res,2,SWIG_From_int(ret2));
1369 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1372 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1373 if (!SWIG_IsOK(res1))
1376 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1377 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1381 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1383 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1384 da2->checkAllocated();
1385 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1389 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1393 std::vector<int> multiVal;
1394 std::pair<int, std::pair<int,int> > slic;
1395 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1396 int nbc=self->getNumberOfCells();
1397 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1404 std::ostringstream oss;
1405 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1406 throw INTERP_KERNEL::Exception(oss.str().c_str());
1409 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1414 int tmp=nbc+singleVal;
1415 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1419 std::ostringstream oss;
1420 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1421 throw INTERP_KERNEL::Exception(oss.str().c_str());
1427 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1431 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1436 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1437 daIntTyypp->checkAllocated();
1438 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1441 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1445 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1448 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1449 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1450 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1451 for(int i=0;i<sz;i++)
1452 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1455 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1458 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1460 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1461 std::vector<double> val3;
1462 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1463 "Rotate2DAlg",2,true,nbNodes);
1465 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1466 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1469 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1472 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1473 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1474 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1475 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1476 for(int i=0;i<sz;i++)
1477 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1480 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1483 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1485 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1486 std::vector<double> val3;
1487 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1488 "Rotate3DAlg",3,true,nbNodes);
1490 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1491 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1492 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1497 //== MEDCouplingPointSet End
1499 class MEDCouplingUMeshCell
1502 INTERP_KERNEL::NormalizedCellType getType() const;
1505 std::string __str__() const throw(INTERP_KERNEL::Exception)
1507 return self->repr();
1510 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1513 const int *r=self->getAllConn(ret2);
1514 PyObject *ret=PyTuple_New(ret2);
1515 for(int i=0;i<ret2;i++)
1516 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1522 class MEDCouplingUMeshCellIterator
1529 MEDCouplingUMeshCell *ret=self->nextt();
1531 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1534 PyErr_SetString(PyExc_StopIteration,"No more data.");
1541 class MEDCouplingUMeshCellByTypeIterator
1544 ~MEDCouplingUMeshCellByTypeIterator();
1549 MEDCouplingUMeshCellEntry *ret=self->nextt();
1551 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1554 PyErr_SetString(PyExc_StopIteration,"No more data.");
1561 class MEDCouplingUMeshCellByTypeEntry
1564 ~MEDCouplingUMeshCellByTypeEntry();
1567 MEDCouplingUMeshCellByTypeIterator *__iter__()
1569 return self->iterator();
1574 class MEDCouplingUMeshCellEntry
1577 INTERP_KERNEL::NormalizedCellType getType() const;
1578 int getNumberOfElems() const;
1581 MEDCouplingUMeshCellIterator *__iter__()
1583 return self->iterator();
1588 //== MEDCouplingUMesh
1590 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1593 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1594 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1595 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1596 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1597 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1598 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1599 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1600 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1601 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1602 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1603 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1604 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1605 void computeTypes() throw(INTERP_KERNEL::Exception);
1606 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1607 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1609 DataArrayInt *conformize2D(double eps) throw(INTERP_KERNEL::Exception);
1610 DataArrayInt *colinearize2D(double eps) throw(INTERP_KERNEL::Exception);
1611 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1612 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1613 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1614 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1615 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1616 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1617 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1618 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1619 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1620 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1621 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1622 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1623 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1624 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1625 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1626 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1627 bool isFullyQuadratic() const throw(INTERP_KERNEL::Exception);
1628 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1629 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1630 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1631 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1632 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1633 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1634 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1635 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1636 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1637 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1638 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1639 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1640 DataArrayDouble *computePlaneEquationOf3DFaces() const throw(INTERP_KERNEL::Exception);
1641 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1642 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1643 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1644 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1645 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1646 DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1647 DataArrayInt *buildUnionOf2DMesh() const throw(INTERP_KERNEL::Exception);
1648 DataArrayInt *buildUnionOf3DMesh() const throw(INTERP_KERNEL::Exception);
1649 DataArrayDouble *getBoundingBoxForBBTreeFast() const throw(INTERP_KERNEL::Exception);
1650 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1651 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1652 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);
1653 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1654 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1655 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1656 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1657 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1659 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1661 return MEDCouplingUMesh::New();
1664 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1666 return MEDCouplingUMesh::New(meshName,meshDim);
1669 std::string __str__() const throw(INTERP_KERNEL::Exception)
1671 return self->simpleRepr();
1674 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1676 std::ostringstream oss;
1677 self->reprQuickOverview(oss);
1681 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1683 return self->cellIterator();
1686 PyObject *getAllGeoTypesSorted() const throw(INTERP_KERNEL::Exception)
1688 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
1689 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1690 PyObject *res=PyList_New(result.size());
1691 for(int i=0;iL!=result.end(); i++, iL++)
1692 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1696 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1700 std::vector<int> multiVal;
1701 std::pair<int, std::pair<int,int> > slic;
1702 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1703 int nbc=self->getNumberOfCells();
1704 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1711 std::ostringstream oss;
1712 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1713 throw INTERP_KERNEL::Exception(oss.str().c_str());
1717 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1724 int tmp=nbc+singleVal;
1725 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1730 std::ostringstream oss;
1731 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1732 throw INTERP_KERNEL::Exception(oss.str().c_str());
1738 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1744 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1745 daIntTyypp->checkAllocated();
1746 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1750 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1754 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1758 std::vector<int> multiVal;
1759 std::pair<int, std::pair<int,int> > slic;
1760 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1761 int nbc=self->getNumberOfCells();
1762 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1769 std::ostringstream oss;
1770 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1771 throw INTERP_KERNEL::Exception(oss.str().c_str());
1775 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1782 int tmp=nbc+singleVal;
1783 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1788 std::ostringstream oss;
1789 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1790 throw INTERP_KERNEL::Exception(oss.str().c_str());
1796 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1801 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1807 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1808 daIntTyypp->checkAllocated();
1809 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1813 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1817 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1819 int szArr,sw,iTypppArr;
1820 std::vector<int> stdvecTyyppArr;
1821 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1824 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1825 throw INTERP_KERNEL::Exception(oss.str().c_str());
1827 self->insertNextCell(type,size,tmp);
1830 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1832 int szArr,sw,iTypppArr;
1833 std::vector<int> stdvecTyyppArr;
1834 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1835 self->insertNextCell(type,szArr,tmp);
1838 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1840 DataArrayInt *ret=self->getNodalConnectivity();
1845 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1847 DataArrayInt *ret=self->getNodalConnectivityIndex();
1853 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1855 int szArr,sw,iTypppArr;
1856 std::vector<int> stdvecTyyppArr;
1857 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1858 int nbOfDepthPeelingPerformed=0;
1859 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1860 PyObject *res=PyTuple_New(2);
1861 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1862 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1866 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1868 DataArrayInt *v0=0,*v1=0;
1869 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1870 PyObject *res = PyList_New(2);
1871 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1872 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1876 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1880 DataArrayDoubleTuple *aa;
1881 std::vector<double> bb;
1883 int nbOfCompo=self->getSpaceDimension();
1884 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1887 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1888 PyObject *ret=PyTuple_New(2);
1889 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1890 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1894 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1896 DataArrayInt *ret1=0;
1897 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1898 PyObject *ret=PyTuple_New(2);
1899 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1900 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1904 PyObject *tetrahedrize(int policy) throw(INTERP_KERNEL::Exception)
1907 DataArrayInt *ret1(0);
1908 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
1909 PyObject *ret=PyTuple_New(3);
1910 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
1911 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1912 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
1916 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1918 std::vector<int> cells;
1919 self->checkButterflyCells(cells,eps);
1920 DataArrayInt *ret=DataArrayInt::New();
1921 ret->alloc((int)cells.size(),1);
1922 std::copy(cells.begin(),cells.end(),ret->getPointer());
1923 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1926 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1928 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1930 PyObject *ret = PyList_New(sz);
1931 for(int i=0;i<sz;i++)
1932 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1936 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1938 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1939 int sz=retCpp.size();
1940 PyObject *ret=PyList_New(sz);
1941 for(int i=0;i<sz;i++)
1942 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1946 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1949 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1950 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1951 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1954 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1957 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1958 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1962 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1965 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1966 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1970 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1972 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1973 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1974 PyObject *ret=PyTuple_New(3);
1975 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1976 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1977 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1981 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1983 DataArrayInt *tmp0=0,*tmp1=0;
1984 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1985 PyObject *ret=PyTuple_New(2);
1986 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1987 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1991 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1995 std::vector<int> multiVal;
1996 std::pair<int, std::pair<int,int> > slic;
1997 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1998 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2002 return self->duplicateNodes(&singleVal,&singleVal+1);
2004 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
2006 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
2008 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2012 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
2016 std::vector<int> multiVal;
2017 std::pair<int, std::pair<int,int> > slic;
2018 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2019 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2023 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
2025 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
2027 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
2029 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2033 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
2036 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
2037 DataArrayInt *tmp0,*tmp1=0;
2038 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2039 PyObject *ret=PyTuple_New(2);
2040 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2041 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2045 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const throw(INTERP_KERNEL::Exception)
2047 DataArrayInt *ret0=0,*ret1=0;
2048 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
2049 PyObject *ret=PyTuple_New(2);
2050 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2051 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2055 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2057 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2058 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2059 DataArrayInt *ret1=0,*ret2=0;
2060 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2061 PyObject *ret=PyTuple_New(3);
2062 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2063 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2064 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2068 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2070 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2071 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2072 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2073 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2076 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
2079 std::vector<const MEDCouplingUMesh *> meshes;
2080 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2081 std::vector<DataArrayInt *> corr;
2082 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2084 PyObject *ret1=PyList_New(sz);
2085 for(int i=0;i<sz;i++)
2086 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2087 PyObject *ret=PyList_New(2);
2088 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2089 PyList_SetItem(ret,1,ret1);
2093 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2095 std::vector<MEDCouplingUMesh *> meshes;
2096 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2097 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2100 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
2102 std::vector<MEDCouplingUMesh *> meshes;
2103 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2104 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2107 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
2111 std::vector<int> multiVal;
2112 std::pair<int, std::pair<int,int> > slic;
2113 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2115 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2116 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2120 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2122 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2124 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2126 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2130 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2132 DataArrayInt *arrOut=0,*arrIndexOut=0;
2135 std::vector<int> multiVal;
2136 std::pair<int, std::pair<int,int> > slic;
2137 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2139 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2140 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2145 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2150 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2155 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2159 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2161 PyObject *ret=PyTuple_New(2);
2162 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2163 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2167 static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2169 DataArrayInt *arrOut=0,*arrIndexOut=0;
2170 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2171 PyObject *ret=PyTuple_New(2);
2172 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2173 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2177 static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2179 if(!PySlice_Check(slic))
2180 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !");
2181 Py_ssize_t strt=2,stp=2,step=2;
2182 PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
2184 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !");
2185 arrIndxIn->checkAllocated();
2186 if(arrIndxIn->getNumberOfComponents()!=1)
2187 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !");
2188 GetIndicesOfSlice(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !");
2189 DataArrayInt *arrOut=0,*arrIndexOut=0;
2190 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2191 PyObject *ret=PyTuple_New(2);
2192 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2193 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2197 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2198 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2199 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2201 DataArrayInt *arrOut=0,*arrIndexOut=0;
2204 std::vector<int> multiVal;
2205 std::pair<int, std::pair<int,int> > slic;
2206 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2208 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2209 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2214 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2219 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2224 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2228 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2230 PyObject *ret=PyTuple_New(2);
2231 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2232 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2236 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2237 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2241 std::vector<int> multiVal;
2242 std::pair<int, std::pair<int,int> > slic;
2243 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2245 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2246 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2251 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2256 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2261 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2265 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2269 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2273 DataArrayDoubleTuple *aa;
2274 std::vector<double> bb;
2276 int spaceDim=self->getSpaceDimension();
2277 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2278 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2280 std::vector<int> cells;
2281 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2282 DataArrayInt *ret=DataArrayInt::New();
2283 ret->alloc((int)cells.size(),1);
2284 std::copy(cells.begin(),cells.end(),ret->getPointer());
2285 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2288 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2292 DataArrayDoubleTuple *aa;
2293 std::vector<double> bb;
2295 int spaceDim=self->getSpaceDimension();
2296 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2297 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2298 self->orientCorrectly2DCells(v,polyOnly);
2301 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2303 std::vector<int> cells;
2304 self->arePolyhedronsNotCorrectlyOriented(cells);
2305 DataArrayInt *ret=DataArrayInt::New();
2306 ret->alloc((int)cells.size(),1);
2307 std::copy(cells.begin(),cells.end(),ret->getPointer());
2308 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2311 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2315 self->getFastAveragePlaneOfThis(vec,pos);
2317 std::copy(vec,vec+3,vals);
2318 std::copy(pos,pos+3,vals+3);
2319 return convertDblArrToPyListOfTuple(vals,3,2);
2322 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2324 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2325 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2326 return MEDCouplingUMesh::MergeUMeshes(tmp);
2329 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2332 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2333 PyObject *ret=PyTuple_New(2);
2334 PyObject *ret0Py=ret0?Py_True:Py_False;
2336 PyTuple_SetItem(ret,0,ret0Py);
2337 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2341 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2344 bool ret0=self->areCellsIncludedIn2(other,ret1);
2345 PyObject *ret=PyTuple_New(2);
2346 PyObject *ret0Py=ret0?Py_True:Py_False;
2348 PyTuple_SetItem(ret,0,ret0Py);
2349 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2353 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2355 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2356 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2357 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2358 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2359 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2360 PyObject *ret=PyTuple_New(5);
2361 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2362 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2363 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2364 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2365 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2369 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2371 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2372 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2373 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2374 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2375 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2376 PyObject *ret=PyTuple_New(5);
2377 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2378 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2379 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2380 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2381 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2385 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2387 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2388 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2389 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2390 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2391 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2392 PyObject *ret=PyTuple_New(5);
2393 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2394 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2395 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2396 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2397 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2401 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2403 DataArrayInt *neighbors=0,*neighborsIdx=0;
2404 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2405 PyObject *ret=PyTuple_New(2);
2406 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2407 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2411 PyObject *computeNeighborsOfNodes() const throw(INTERP_KERNEL::Exception)
2413 DataArrayInt *neighbors=0,*neighborsIdx=0;
2414 self->computeNeighborsOfNodes(neighbors,neighborsIdx);
2415 PyObject *ret=PyTuple_New(2);
2416 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2417 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2421 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2423 DataArrayInt *neighbors=0,*neighborsIdx=0;
2424 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2425 PyObject *ret=PyTuple_New(2);
2426 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2427 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2431 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2433 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2434 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2435 DataArrayInt *d2,*d3,*d4,*dd5;
2436 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2437 PyObject *ret=PyTuple_New(7);
2438 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2439 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2440 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2441 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2442 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2443 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2444 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2448 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2451 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2452 da->checkAllocated();
2453 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2456 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2459 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2460 da->checkAllocated();
2461 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2464 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2467 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2468 da->checkAllocated();
2469 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2472 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2475 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2476 da->checkAllocated();
2477 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2478 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2479 PyObject *res = PyList_New(result.size());
2480 for (int i=0;iL!=result.end(); i++, iL++)
2481 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2485 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2488 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2489 da->checkAllocated();
2490 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2491 ret->setName(da->getName().c_str());
2495 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2497 DataArrayInt *cellNb1=0,*cellNb2=0;
2498 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2499 PyObject *ret=PyTuple_New(3);
2500 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2501 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2502 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2506 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2508 int spaceDim=self->getSpaceDimension();
2510 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2512 DataArrayDouble *a,*a2;
2513 DataArrayDoubleTuple *aa,*aa2;
2514 std::vector<double> bb,bb2;
2516 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2517 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2518 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2519 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2521 DataArrayInt *cellIds=0;
2522 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2523 PyObject *ret=PyTuple_New(2);
2524 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2525 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2529 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2531 int spaceDim=self->getSpaceDimension();
2533 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2535 DataArrayDouble *a,*a2;
2536 DataArrayDoubleTuple *aa,*aa2;
2537 std::vector<double> bb,bb2;
2539 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2540 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2541 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2542 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2544 DataArrayInt *cellIds=0;
2545 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2546 PyObject *ret=PyTuple_New(2);
2547 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2548 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2552 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2554 int spaceDim=self->getSpaceDimension();
2556 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2558 DataArrayDouble *a,*a2;
2559 DataArrayDoubleTuple *aa,*aa2;
2560 std::vector<double> bb,bb2;
2562 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2563 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2564 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2565 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2566 return self->getCellIdsCrossingPlane(orig,vect,eps);
2569 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2573 std::vector<int> pos2;
2574 DataArrayInt *pos3=0;
2575 DataArrayIntTuple *pos4=0;
2576 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2581 self->convertToPolyTypes(&pos1,&pos1+1);
2588 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2593 self->convertToPolyTypes(pos3->begin(),pos3->end());
2597 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2601 void convertAllToPoly();
2602 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2603 bool unPolyze() throw(INTERP_KERNEL::Exception);
2604 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2605 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2606 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2609 //== MEDCouplingUMesh End
2611 //== MEDCouplingExtrudedMesh
2613 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2616 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2617 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2619 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2621 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2624 std::string __str__() const throw(INTERP_KERNEL::Exception)
2626 return self->simpleRepr();
2629 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2631 std::ostringstream oss;
2632 self->reprQuickOverview(oss);
2636 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2638 MEDCouplingUMesh *ret=self->getMesh2D();
2641 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2643 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2645 MEDCouplingUMesh *ret=self->getMesh1D();
2648 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2650 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2652 DataArrayInt *ret=self->getMesh3DIds();
2655 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2660 //== MEDCouplingExtrudedMesh End
2662 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2665 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2666 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2667 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2668 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2669 virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2670 virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
2673 virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2675 int szArr,sw,iTypppArr;
2676 std::vector<int> stdvecTyyppArr;
2677 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2678 self->insertNextCell(tmp,tmp+szArr);
2681 virtual DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2683 DataArrayInt *ret=self->getNodalConnectivity();
2684 if(ret) ret->incrRef();
2688 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2690 std::vector< const MEDCoupling1GTUMesh *> parts;
2691 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
2692 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
2697 //== MEDCoupling1SGTUMesh
2699 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2702 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2703 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2704 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2705 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2706 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2707 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2708 MEDCoupling1GTUMesh *computeDualMesh() const throw(INTERP_KERNEL::Exception);
2709 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const throw(INTERP_KERNEL::Exception);
2710 DataArrayInt *sortHexa8EachOther() throw(INTERP_KERNEL::Exception);
2713 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2715 return MEDCoupling1SGTUMesh::New(name,type);
2718 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2720 return MEDCoupling1SGTUMesh::New(m);
2723 std::string __str__() const throw(INTERP_KERNEL::Exception)
2725 return self->simpleRepr();
2728 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2730 std::ostringstream oss;
2731 self->reprQuickOverview(oss);
2735 PyObject *structurizeMe(double eps=1e-12) const throw(INTERP_KERNEL::Exception)
2737 DataArrayInt *cellPerm(0),*nodePerm(0);
2738 MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps));
2739 PyObject *ret(PyTuple_New(3));
2740 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 ));
2741 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2742 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2746 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2748 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2749 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2750 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2753 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2755 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2756 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2757 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2762 //== MEDCoupling1SGTUMesh End
2764 //== MEDCoupling1DGTUMesh
2766 class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2769 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2770 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2771 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
2772 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2773 bool isPacked() const throw(INTERP_KERNEL::Exception);
2776 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2778 return MEDCoupling1DGTUMesh::New(name,type);
2781 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2783 return MEDCoupling1DGTUMesh::New(m);
2786 std::string __str__() const throw(INTERP_KERNEL::Exception)
2788 return self->simpleRepr();
2791 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2793 std::ostringstream oss;
2794 self->reprQuickOverview(oss);
2798 DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
2800 DataArrayInt *ret=self->getNodalConnectivityIndex();
2801 if(ret) ret->incrRef();
2805 PyObject *retrievePackedNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2807 DataArrayInt *ret1=0,*ret2=0;
2808 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
2809 PyObject *ret0Py=ret0?Py_True:Py_False;
2811 PyObject *ret=PyTuple_New(3);
2812 PyTuple_SetItem(ret,0,ret0Py);
2813 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2814 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2818 PyObject *copyWithNodalConnectivityPacked() const throw(INTERP_KERNEL::Exception)
2821 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
2822 PyObject *ret=PyTuple_New(2);
2823 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
2824 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
2825 PyTuple_SetItem(ret,1,ret1Py);
2829 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2831 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2832 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2833 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
2836 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2838 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2839 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2840 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
2843 static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt) throw(INTERP_KERNEL::Exception)
2845 std::vector<const ParaMEDMEM::DataArrayInt *> tmp;
2846 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2847 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
2852 //== MEDCoupling1DGTUMeshEnd
2854 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2857 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2858 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2859 int getNumberOfCellsOfSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2860 int getSpaceDimensionOnNodeStruct() const throw(INTERP_KERNEL::Exception);
2861 virtual std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2862 std::vector<int> getCellGridStructure() const throw(INTERP_KERNEL::Exception);
2863 MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception);
2864 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
2865 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2866 static int DeduceNumberOfGivenStructure(const std::vector<int>& st) throw(INTERP_KERNEL::Exception);
2867 static std::vector<int> GetSplitVectFromStruct(const std::vector<int>& strct) throw(INTERP_KERNEL::Exception);
2870 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const throw(INTERP_KERNEL::Exception)
2872 int tmpp1=-1,tmpp2=-1;
2873 std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
2874 std::vector< std::pair<int,int> > inp;
2878 for(int i=0;i<tmpp1;i++)
2879 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2884 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
2885 inp.resize(tmpp1/2);
2886 for(int i=0;i<tmpp1/2;i++)
2887 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2890 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
2891 return self->buildStructuredSubPart(inp);
2894 static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) throw(INTERP_KERNEL::Exception)
2896 std::vector< std::pair<int,int> > inp;
2897 convertPyToVectorPairInt(part,inp);
2899 int szArr,sw,iTypppArr;
2900 std::vector<int> stdvecTyyppArr;
2901 const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
2902 std::vector<int> tmp5(tmp4,tmp4+szArr);
2904 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
2907 static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector<int>& st, const DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat) throw(INTERP_KERNEL::Exception)
2909 std::vector< std::pair<int,int> > inp;
2910 convertPyToVectorPairInt(partCompactFormat,inp);
2911 return MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,fieldOfDbl,inp);
2914 static int DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part) throw(INTERP_KERNEL::Exception)
2916 std::vector< std::pair<int,int> > inp;
2917 convertPyToVectorPairInt(part,inp);
2918 return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp);
2921 static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) throw(INTERP_KERNEL::Exception)
2923 int szArr,sw,iTypppArr;
2924 std::vector<int> stdvecTyyppArr;
2925 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2926 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
2929 static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2931 int szArr,sw,iTypppArr;
2932 std::vector<int> stdvecTyyppArr;
2933 const int *tmp(convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr));
2934 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
2937 static std::vector<int> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat) throw(INTERP_KERNEL::Exception)
2939 std::vector< std::pair<int,int> > inp;
2940 convertPyToVectorPairInt(partCompactFormat,inp);
2941 return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp);
2944 static PyObject *GetCompactFrmtFromDimensions(const std::vector<int>& dims) throw(INTERP_KERNEL::Exception)
2946 std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dims));
2947 PyObject *retPy=PyList_New(ret.size());
2948 for(std::size_t i=0;i<ret.size();i++)
2950 PyObject *tmp=PyTuple_New(2);
2951 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
2952 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
2953 PyList_SetItem(retPy,i,tmp);
2958 static PyObject *IntersectRanges(PyObject *r1, PyObject *r2) throw(INTERP_KERNEL::Exception)
2960 std::vector< std::pair<int,int> > r1Cpp,r2Cpp;
2961 convertPyToVectorPairInt(r1,r1Cpp);
2962 convertPyToVectorPairInt(r2,r2Cpp);
2963 std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::IntersectRanges(r1Cpp,r2Cpp));
2964 PyObject *retPy=PyList_New(ret.size());
2965 for(std::size_t i=0;i<ret.size();i++)
2967 PyObject *tmp=PyTuple_New(2);
2968 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
2969 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
2970 PyList_SetItem(retPy,i,tmp);
2975 static PyObject *IsPartStructured(PyObject *li, PyObject *st) throw(INTERP_KERNEL::Exception)
2977 int szArr,sw,iTypppArr;
2978 std::vector<int> stdvecTyyppArr;
2979 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2980 int szArr2,sw2,iTypppArr2;
2981 std::vector<int> stdvecTyyppArr2;
2982 const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
2983 std::vector<int> tmp3(tmp2,tmp2+szArr2);
2984 std::vector< std::pair<int,int> > partCompactFormat;
2985 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
2986 PyObject *ret=PyTuple_New(2);
2987 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
2988 PyTuple_SetItem(ret,0,ret0Py);
2989 PyObject *ret1Py=PyList_New(partCompactFormat.size());
2990 for(std::size_t i=0;i<partCompactFormat.size();i++)
2992 PyObject *tmp4=PyTuple_New(2);
2993 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
2994 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
2995 PyList_SetItem(ret1Py,i,tmp4);
2997 PyTuple_SetItem(ret,1,ret1Py);
3001 static PyObject *ChangeReferenceFromGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigInAbs, bool check=true) throw(INTERP_KERNEL::Exception)
3003 std::vector< std::pair<int,int> > param0,param1,ret;
3004 convertPyToVectorPairInt(bigInAbs,param0);
3005 convertPyToVectorPairInt(partOfBigInAbs,param1);
3006 MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(param0,param1,ret,check);
3007 PyObject *retPy(PyList_New(ret.size()));
3008 for(std::size_t i=0;i<ret.size();i++)
3010 PyObject *tmp(PyTuple_New(2));
3011 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3012 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3013 PyList_SetItem(retPy,i,tmp);
3018 static PyObject *TranslateCompactFrmt(PyObject *part, const std::vector<int>& translation) throw(INTERP_KERNEL::Exception)
3020 std::vector< std::pair<int,int> > param0;
3021 convertPyToVectorPairInt(part,param0);
3022 std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::TranslateCompactFrmt(param0,translation));
3023 PyObject *retPy(PyList_New(ret.size()));
3024 for(std::size_t i=0;i<ret.size();i++)
3026 PyObject *tmp(PyTuple_New(2));
3027 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3028 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3029 PyList_SetItem(retPy,i,tmp);
3034 static std::vector<int> FindTranslationFrom(PyObject *startingFrom, PyObject *goingTo) throw(INTERP_KERNEL::Exception)
3036 std::vector< std::pair<int,int> > param0,param1;
3037 convertPyToVectorPairInt(startingFrom,param0);
3038 convertPyToVectorPairInt(goingTo,param1);
3039 return MEDCouplingStructuredMesh::FindTranslationFrom(param0,param1);
3042 static PyObject *ChangeReferenceToGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigRelativeToBig, bool check=true) throw(INTERP_KERNEL::Exception)
3044 std::vector< std::pair<int,int> > param0,param1,ret;
3045 convertPyToVectorPairInt(bigInAbs,param0);
3046 convertPyToVectorPairInt(partOfBigRelativeToBig,param1);
3047 MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(param0,param1,ret,check);
3048 PyObject *retPy(PyList_New(ret.size()));
3049 for(std::size_t i=0;i<ret.size();i++)
3051 PyObject *tmp(PyTuple_New(2));
3052 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3053 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3054 PyList_SetItem(retPy,i,tmp);
3061 //== MEDCouplingCMesh
3063 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3066 static MEDCouplingCMesh *New() throw(INTERP_KERNEL::Exception);
3067 static MEDCouplingCMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
3068 MEDCouplingCMesh *clone(bool recDeepCpy) const;
3069 void setCoords(const DataArrayDouble *coordsX,
3070 const DataArrayDouble *coordsY=0,
3071 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
3072 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
3074 MEDCouplingCMesh() throw(INTERP_KERNEL::Exception)
3076 return MEDCouplingCMesh::New();
3078 MEDCouplingCMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
3080 return MEDCouplingCMesh::New(meshName);
3082 std::string __str__() const throw(INTERP_KERNEL::Exception)
3084 return self->simpleRepr();
3086 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3088 std::ostringstream oss;
3089 self->reprQuickOverview(oss);
3092 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
3094 DataArrayDouble *ret=self->getCoordsAt(i);
3102 //== MEDCouplingCMesh End
3104 //== MEDCouplingCurveLinearMesh
3106 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3109 static MEDCouplingCurveLinearMesh *New() throw(INTERP_KERNEL::Exception);
3110 static MEDCouplingCurveLinearMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
3111 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
3112 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
3114 MEDCouplingCurveLinearMesh() throw(INTERP_KERNEL::Exception)
3116 return MEDCouplingCurveLinearMesh::New();
3118 MEDCouplingCurveLinearMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
3120 return MEDCouplingCurveLinearMesh::New(meshName);
3122 std::string __str__() const throw(INTERP_KERNEL::Exception)
3124 return self->simpleRepr();
3126 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3128 std::ostringstream oss;
3129 self->reprQuickOverview(oss);
3132 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
3134 DataArrayDouble *ret=self->getCoords();
3139 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
3141 int szArr,sw,iTypppArr;
3142 std::vector<int> stdvecTyyppArr;
3143 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
3144 self->setNodeGridStructure(tmp,tmp+szArr);
3149 //== MEDCouplingCurveLinearMesh End
3151 //== MEDCouplingIMesh
3153 class MEDCouplingIMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3156 static MEDCouplingIMesh *New() throw(INTERP_KERNEL::Exception);
3158 void setSpaceDimension(int spaceDim) throw(INTERP_KERNEL::Exception);
3159 std::vector<int> getNodeStruct() const throw(INTERP_KERNEL::Exception);
3160 std::vector<double> getOrigin() const throw(INTERP_KERNEL::Exception);
3161 std::vector<double> getDXYZ() const throw(INTERP_KERNEL::Exception);
3162 void setAxisUnit(const std::string& unitName) throw(INTERP_KERNEL::Exception);
3163 std::string getAxisUnit() const throw(INTERP_KERNEL::Exception);
3164 double getMeasureOfAnyCell() const throw(INTERP_KERNEL::Exception);
3165 MEDCouplingCMesh *convertToCartesian() const throw(INTERP_KERNEL::Exception);
3166 void refineWithFactor(const std::vector<int>& factors) throw(INTERP_KERNEL::Exception);
3167 MEDCouplingIMesh *asSingleCell() const throw(INTERP_KERNEL::Exception);
3168 MEDCouplingIMesh *buildWithGhost(int ghostLev) const throw(INTERP_KERNEL::Exception);
3173 return MEDCouplingIMesh::New();
3175 static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3177 static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
3178 static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
3179 const int *nodeStrctPtr(0);
3180 const double *originPtr(0),*dxyzPtr(0);
3182 std::vector<int> bb0;
3183 nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
3186 std::vector<double> bb,bb2;
3188 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
3189 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
3191 return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
3194 MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3196 return ParaMEDMEM_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
3199 void setNodeStruct(PyObject *nodeStrct) throw(INTERP_KERNEL::Exception)
3202 std::vector<int> bb0;
3203 const int *nodeStrctPtr(convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0));
3204 self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
3207 void setOrigin(PyObject *origin) throw(INTERP_KERNEL::Exception)
3209 static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3212 DataArrayDoubleTuple *aa;
3213 std::vector<double> bb;
3215 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
3216 self->setOrigin(originPtr,originPtr+nbTuples);
3219 void setDXYZ(PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3221 static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3224 DataArrayDoubleTuple *aa;
3225 std::vector<double> bb;
3227 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
3228 self->setDXYZ(originPtr,originPtr+nbTuples);
3231 static void CondenseFineToCoarse(const std::vector<int>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, DataArrayDouble *coarseDA) throw(INTERP_KERNEL::Exception)
3233 std::vector< std::pair<int,int> > inp;
3234 convertPyToVectorPairInt(fineLocInCoarse,inp);
3235 MEDCouplingIMesh::CondenseFineToCoarse(coarseSt,fineDA,inp,facts,coarseDA);
3238 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)
3240 std::vector< std::pair<int,int> > inp;
3241 convertPyToVectorPairInt(fineLocInCoarse,inp);
3242 MEDCouplingIMesh::CondenseFineToCoarseGhost(coarseSt,fineDA,inp,facts,coarseDA,ghostSize);
3245 static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts) throw(INTERP_KERNEL::Exception)
3247 std::vector< std::pair<int,int> > inp;
3248 convertPyToVectorPairInt(fineLocInCoarse,inp);
3249 MEDCouplingIMesh::SpreadCoarseToFine(coarseDA,coarseSt,fineDA,inp,facts);
3252 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)
3254 std::vector< std::pair<int,int> > inp;
3255 convertPyToVectorPairInt(fineLocInCoarse,inp);
3256 MEDCouplingIMesh::SpreadCoarseToFineGhost(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3259 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)
3261 std::vector< std::pair<int,int> > inp;
3262 convertPyToVectorPairInt(fineLocInCoarse,inp);
3263 MEDCouplingIMesh::SpreadCoarseToFineGhostZone(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3266 std::string __str__() const throw(INTERP_KERNEL::Exception)
3268 return self->simpleRepr();
3270 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3272 std::ostringstream oss;
3273 self->reprQuickOverview(oss);
3279 //== MEDCouplingIMesh End
3283 namespace ParaMEDMEM
3285 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
3288 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
3289 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
3290 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3291 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3292 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
3293 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
3294 void setName(const char *name) throw(INTERP_KERNEL::Exception);
3295 std::string getDescription() const throw(INTERP_KERNEL::Exception);
3296 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
3297 std::string getName() const throw(INTERP_KERNEL::Exception);
3298 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
3299 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
3300 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
3301 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
3302 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
3303 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
3304 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
3305 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3306 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
3307 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
3308 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
3309 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
3310 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
3311 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
3312 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
3313 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3315 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
3317 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3320 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3323 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
3325 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3328 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3331 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
3333 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
3334 return convertIntArrToPyList3(ret);
3337 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
3340 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
3341 PyObject *ret=PyTuple_New(2);
3342 PyObject *ret0Py=ret0?Py_True:Py_False;
3344 PyTuple_SetItem(ret,0,ret0Py);
3345 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3349 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
3351 DataArrayInt *ret1=0;
3352 MEDCouplingMesh *ret0=0;
3354 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3355 if (!SWIG_IsOK(res1))
3358 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3359 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3363 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3365 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3366 da2->checkAllocated();
3367 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3369 PyObject *res = PyList_New(2);
3370 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3371 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3375 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
3377 DataArrayInt *ret1=0;
3379 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3380 PyObject *res=PyTuple_New(2);
3381 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3383 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3386 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3387 PyTuple_SetItem(res,1,res1);
3392 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3395 int v0; std::vector<int> v1;
3396 const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
3397 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3400 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3401 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3404 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3405 if (!SWIG_IsOK(res1))
3408 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3409 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3413 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3415 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3416 da2->checkAllocated();
3417 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3421 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3423 std::vector<int> tmp;
3424 self->getCellIdsHavingGaussLocalization(locId,tmp);
3425 DataArrayInt *ret=DataArrayInt::New();
3426 ret->alloc((int)tmp.size(),1);
3427 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3428 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3431 int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
3433 std::vector<int> inp0;
3434 convertPyToNewIntArr4(code,1,3,inp0);
3435 std::vector<const DataArrayInt *> inp1;
3436 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(idsPerType,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",inp1);
3437 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3442 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3445 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3446 static MEDCouplingFieldTemplate *New(TypeOfField type);
3447 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3448 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3451 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3453 return MEDCouplingFieldTemplate::New(f);
3456 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3458 return MEDCouplingFieldTemplate::New(type);
3461 std::string __str__() const throw(INTERP_KERNEL::Exception)
3463 return self->simpleRepr();
3466 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3468 std::ostringstream oss;
3469 self->reprQuickOverview(oss);
3475 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3478 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3479 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3480 void setTimeUnit(const std::string& unit);
3481 std::string getTimeUnit() const;
3482 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3483 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3484 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3485 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3486 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3487 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
3488 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3489 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3490 MEDCouplingFieldDouble *deepCpy() const;
3491 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3492 MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
3493 MEDCouplingFieldDouble *cellToNodeDiscretization() const throw(INTERP_KERNEL::Exception);
3494 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3495 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3496 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3497 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3498 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3499 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3500 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3501 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3502 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3503 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3504 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
3505 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3506 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3507 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3508 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3509 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3510 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3511 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3512 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3513 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3514 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3515 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3516 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3517 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3518 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3519 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3520 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3521 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3522 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3523 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3524 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3525 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3526 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3527 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3528 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3529 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3530 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3531 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3532 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3533 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3534 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3535 void fillFromAnalytic(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3536 void fillFromAnalytic2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3537 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3538 void applyFunc(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3539 void applyFunc2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3540 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3541 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3542 void applyFunc(const std::string& func) throw(INTERP_KERNEL::Exception);
3543 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
3544 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
3545 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3546 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3547 double getMinValue() const throw(INTERP_KERNEL::Exception);
3548 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3549 double norm2() const throw(INTERP_KERNEL::Exception);
3550 double normMax() const throw(INTERP_KERNEL::Exception);
3551 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3552 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3553 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3554 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3555 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3556 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3557 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3558 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3559 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3560 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3561 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3562 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3563 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3564 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3565 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3566 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3567 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3568 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3569 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3570 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3571 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3572 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3574 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3576 return MEDCouplingFieldDouble::New(type,td);
3579 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3581 return MEDCouplingFieldDouble::New(ft,td);
3584 std::string __str__() const throw(INTERP_KERNEL::Exception)
3586 return self->simpleRepr();
3589 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3591 std::ostringstream oss;
3592 self->reprQuickOverview(oss);
3596 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3598 DataArrayDouble *ret=self->getArray();
3604 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3606 std::vector<DataArrayDouble *> arrs=self->getArrays();
3607 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3611 PyObject *ret=PyTuple_New(sz);
3612 for(int i=0;i<sz;i++)
3615 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3617 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3622 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3624 std::vector<const DataArrayDouble *> tmp;
3625 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3627 std::vector<DataArrayDouble *> arrs(sz);
3628 for(int i=0;i<sz;i++)
3629 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3630 self->setArrays(arrs);
3633 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3635 DataArrayDouble *ret=self->getEndArray();
3641 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3645 DataArrayDoubleTuple *aa;
3646 std::vector<double> bb;
3648 const MEDCouplingMesh *mesh=self->getMesh();
3650 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3651 int spaceDim=mesh->getSpaceDimension();
3652 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3653 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3655 int sz=self->getNumberOfComponents();
3656 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3657 self->getValueOn(spaceLoc,res);
3658 return convertDblArrToPyList(res,sz);
3661 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3663 int sz=self->getNumberOfComponents();
3664 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3665 self->getValueOnPos(i,j,k,res);
3666 return convertDblArrToPyList(res,sz);
3669 DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
3671 const MEDCouplingMesh *mesh(self->getMesh());
3673 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3676 double v0; ParaMEDMEM::DataArrayDouble *v1(0); ParaMEDMEM::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
3677 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
3678 mesh->getSpaceDimension(),true,nbPts);
3679 return self->getValueOnMulti(inp,nbPts);
3682 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3686 DataArrayDoubleTuple *aa;
3687 std::vector<double> bb;
3689 const MEDCouplingMesh *mesh=self->getMesh();
3691 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3692 int spaceDim=mesh->getSpaceDimension();
3693 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3694 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3697 int sz=self->getNumberOfComponents();
3698 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3699 self->getValueOn(spaceLoc,time,res);
3700 return convertDblArrToPyList(res,sz);
3703 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3705 if(self->getArray()!=0)
3706 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3709 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3710 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3711 self->setArray(arr);
3715 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3718 double tmp0=self->getTime(tmp1,tmp2);
3719 PyObject *res = PyList_New(3);
3720 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3721 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3722 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3726 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3729 double tmp0=self->getStartTime(tmp1,tmp2);
3730 PyObject *res = PyList_New(3);
3731 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3732 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3733 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3737 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3740 double tmp0=self->getEndTime(tmp1,tmp2);
3741 PyObject *res = PyList_New(3);
3742 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3743 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3744 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3747 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3749 int sz=self->getNumberOfComponents();
3750 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3751 self->accumulate(tmp);
3752 return convertDblArrToPyList(tmp,sz);
3754 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3756 int sz=self->getNumberOfComponents();
3757 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3758 self->integral(isWAbs,tmp);
3759 return convertDblArrToPyList(tmp,sz);
3761 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3763 int sz=self->getNumberOfComponents();
3764 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3765 self->getWeightedAverageValue(tmp,isWAbs);
3766 return convertDblArrToPyList(tmp,sz);
3768 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3770 int sz=self->getNumberOfComponents();
3771 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3773 return convertDblArrToPyList(tmp,sz);
3775 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3777 int sz=self->getNumberOfComponents();
3778 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3780 return convertDblArrToPyList(tmp,sz);
3782 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3784 int szArr,sw,iTypppArr;
3785 std::vector<int> stdvecTyyppArr;
3786 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3787 self->renumberCells(tmp,check);
3790 void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3792 int szArr,sw,iTypppArr;
3793 std::vector<int> stdvecTyyppArr;
3794 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3795 self->renumberCellsWithoutMesh(tmp,check);
3798 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3800 int szArr,sw,iTypppArr;
3801 std::vector<int> stdvecTyyppArr;
3802 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3803 self->renumberNodes(tmp,eps);
3806 void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3808 int szArr,sw,iTypppArr;
3809 std::vector<int> stdvecTyyppArr;
3810 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3811 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
3814 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3818 std::vector<int> multiVal;
3819 std::pair<int, std::pair<int,int> > slic;
3820 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3821 const MEDCouplingMesh *mesh=self->getMesh();
3823 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3824 int nbc=mesh->getNumberOfCells();
3825 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3832 std::ostringstream oss;
3833 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3834 throw INTERP_KERNEL::Exception(oss.str().c_str());
3837 return self->buildSubPart(&singleVal,&singleVal+1);
3842 int tmp=nbc+singleVal;
3843 return self->buildSubPart(&tmp,&tmp+1);
3847 std::ostringstream oss;
3848 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3849 throw INTERP_KERNEL::Exception(oss.str().c_str());
3855 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3859 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3864 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3865 daIntTyypp->checkAllocated();
3866 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3869 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3873 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3875 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";
3876 if(PyTuple_Check(li))
3878 Py_ssize_t sz=PyTuple_Size(li);
3880 throw INTERP_KERNEL::Exception(msg);
3881 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3884 std::vector<int> multiVal;
3885 std::pair<int, std::pair<int,int> > slic;
3886 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3887 if(!self->getArray())
3888 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3890 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3891 catch(INTERP_KERNEL::Exception& e)
3892 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3893 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3894 DataArrayDouble *ret0Arr=ret0->getArray();
3896 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3901 std::vector<int> v2(1,singleVal);
3902 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3903 ret0->setArray(aarr);
3908 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3909 ret0->setArray(aarr);
3914 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3915 std::vector<int> v2(nbOfComp);
3916 for(int i=0;i<nbOfComp;i++)
3917 v2[i]=slic.first+i*slic.second.second;
3918 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3919 ret0->setArray(aarr);
3923 throw INTERP_KERNEL::Exception(msg);
3928 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3931 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3934 double r1=self->getMaxValue2(tmp);
3935 PyObject *ret=PyTuple_New(2);
3936 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3937 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3941 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3944 double r1=self->getMinValue2(tmp);
3945 PyObject *ret=PyTuple_New(2);
3946 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3947 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3951 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3953 std::vector<int> tmp;
3954 convertPyToNewIntArr3(li,tmp);
3955 return self->keepSelectedComponents(tmp);
3958 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3960 std::vector<int> tmp;
3961 convertPyToNewIntArr3(li,tmp);
3962 self->setSelectedComponents(f,tmp);
3965 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3968 DataArrayDouble *a,*a2;
3969 DataArrayDoubleTuple *aa,*aa2;
3970 std::vector<double> bb,bb2;
3973 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
3974 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
3975 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3976 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3978 return self->extractSlice3D(orig,vect,eps);
3981 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3983 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
3986 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3988 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
3991 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3993 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.";
3994 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
3997 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3999 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4001 return (*self)-(*other);
4003 throw INTERP_KERNEL::Exception(msg);
4008 DataArrayDoubleTuple *aa;
4009 std::vector<double> bb;
4011 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4016 if(!self->getArray())
4017 throw INTERP_KERNEL::Exception(msg2);
4018 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
4019 ret->applyLin(1.,-val);
4020 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4021 ret2->setArray(ret);
4026 if(!self->getArray())
4027 throw INTERP_KERNEL::Exception(msg2);
4028 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
4029 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4030 ret2->setArray(ret);
4035 if(!self->getArray())
4036 throw INTERP_KERNEL::Exception(msg2);
4037 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4038 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4039 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4040 ret2->setArray(ret);
4045 if(!self->getArray())
4046 throw INTERP_KERNEL::Exception(msg2);
4047 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4048 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4049 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4050 ret2->setArray(ret);
4054 { throw INTERP_KERNEL::Exception(msg); }
4058 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4060 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
4063 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4065 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
4068 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4070 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
4073 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4075 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.";
4076 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
4079 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4081 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4083 return (*self)/(*other);
4085 throw INTERP_KERNEL::Exception(msg);
4090 DataArrayDoubleTuple *aa;
4091 std::vector<double> bb;
4093 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4099 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
4100 if(!self->getArray())
4101 throw INTERP_KERNEL::Exception(msg2);
4102 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
4103 ret->applyLin(1./val,0);
4104 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4105 ret2->setArray(ret);
4110 if(!self->getArray())
4111 throw INTERP_KERNEL::Exception(msg2);
4112 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
4113 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4114 ret2->setArray(ret);
4119 if(!self->getArray())
4120 throw INTERP_KERNEL::Exception(msg2);
4121 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4122 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4123 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4124 ret2->setArray(ret);
4129 if(!self->getArray())
4130 throw INTERP_KERNEL::Exception(msg2);
4131 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4132 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4133 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4134 ret2->setArray(ret);
4138 { throw INTERP_KERNEL::Exception(msg); }
4142 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4144 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
4147 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4149 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.";
4150 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
4153 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4155 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4157 return (*self)^(*other);
4159 throw INTERP_KERNEL::Exception(msg);
4164 DataArrayDoubleTuple *aa;
4165 std::vector<double> bb;
4167 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4172 if(!self->getArray())
4173 throw INTERP_KERNEL::Exception(msg2);
4174 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
4176 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4177 ret2->setArray(ret);
4182 if(!self->getArray())
4183 throw INTERP_KERNEL::Exception(msg2);
4184 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
4185 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4186 ret2->setArray(ret);
4191 if(!self->getArray())
4192 throw INTERP_KERNEL::Exception(msg2);
4193 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4194 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4195 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4196 ret2->setArray(ret);
4201 if(!self->getArray())
4202 throw INTERP_KERNEL::Exception(msg2);
4203 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4204 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4205 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4206 ret2->setArray(ret);
4210 { throw INTERP_KERNEL::Exception(msg); }
4214 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
4216 return self->negate();
4219 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4221 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.";
4222 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
4225 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4227 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4231 Py_XINCREF(trueSelf);
4235 throw INTERP_KERNEL::Exception(msg);
4240 DataArrayDoubleTuple *aa;
4241 std::vector<double> bb;
4243 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4248 if(!self->getArray())
4249 throw INTERP_KERNEL::Exception(msg2);
4250 self->getArray()->applyLin(1.,val);
4251 Py_XINCREF(trueSelf);
4256 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4259 Py_XINCREF(trueSelf);
4264 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4265 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4266 ret2->setArray(aaa);
4268 Py_XINCREF(trueSelf);
4273 if(!self->getArray())
4274 throw INTERP_KERNEL::Exception(msg2);
4275 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4276 self->getArray()->addEqual(aaa);
4277 Py_XINCREF(trueSelf);
4281 { throw INTERP_KERNEL::Exception(msg); }
4285 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4287 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.";
4288 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4291 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4293 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4297 Py_XINCREF(trueSelf);
4301 throw INTERP_KERNEL::Exception(msg);
4306 DataArrayDoubleTuple *aa;
4307 std::vector<double> bb;
4309 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4314 if(!self->getArray())
4315 throw INTERP_KERNEL::Exception(msg2);
4316 self->getArray()->applyLin(1.,-val);
4317 Py_XINCREF(trueSelf);
4322 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4325 Py_XINCREF(trueSelf);
4330 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4331 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4332 ret2->setArray(aaa);
4334 Py_XINCREF(trueSelf);
4339 if(!self->getArray())
4340 throw INTERP_KERNEL::Exception(msg2);
4341 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4342 self->getArray()->substractEqual(aaa);
4343 Py_XINCREF(trueSelf);
4347 { throw INTERP_KERNEL::Exception(msg); }
4351 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4353 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.";
4354 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4357 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4359 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4363 Py_XINCREF(trueSelf);
4367 throw INTERP_KERNEL::Exception(msg);
4372 DataArrayDoubleTuple *aa;
4373 std::vector<double> bb;
4375 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4380 if(!self->getArray())
4381 throw INTERP_KERNEL::Exception(msg2);
4382 self->getArray()->applyLin(val,0);
4383 Py_XINCREF(trueSelf);
4388 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4391 Py_XINCREF(trueSelf);
4396 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4397 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4398 ret2->setArray(aaa);
4400 Py_XINCREF(trueSelf);
4405 if(!self->getArray())
4406 throw INTERP_KERNEL::Exception(msg2);
4407 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4408 self->getArray()->multiplyEqual(aaa);
4409 Py_XINCREF(trueSelf);
4413 { throw INTERP_KERNEL::Exception(msg); }
4417 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4419 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.";
4420 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4423 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4425 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4429 Py_XINCREF(trueSelf);
4433 throw INTERP_KERNEL::Exception(msg);
4438 DataArrayDoubleTuple *aa;
4439 std::vector<double> bb;
4441 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4447 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4448 if(!self->getArray())
4449 throw INTERP_KERNEL::Exception(msg2);
4450 self->getArray()->applyLin(1./val,0);
4451 Py_XINCREF(trueSelf);
4456 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4459 Py_XINCREF(trueSelf);
4464 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4465 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4466 ret2->setArray(aaa);
4468 Py_XINCREF(trueSelf);
4473 if(!self->getArray())
4474 throw INTERP_KERNEL::Exception(msg2);
4475 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4476 self->getArray()->divideEqual(aaa);
4477 Py_XINCREF(trueSelf);
4481 { throw INTERP_KERNEL::Exception(msg); }
4485 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4487 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.";
4488 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4491 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4493 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4497 Py_XINCREF(trueSelf);
4501 throw INTERP_KERNEL::Exception(msg);
4506 DataArrayDoubleTuple *aa;
4507 std::vector<double> bb;
4509 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4514 if(!self->getArray())
4515 throw INTERP_KERNEL::Exception(msg2);
4516 self->getArray()->applyPow(val);
4517 Py_XINCREF(trueSelf);
4522 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4525 Py_XINCREF(trueSelf);
4530 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4531 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4532 ret2->setArray(aaa);
4534 Py_XINCREF(trueSelf);
4539 if(!self->getArray())
4540 throw INTERP_KERNEL::Exception(msg2);
4541 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4542 self->getArray()->powEqual(aaa);
4543 Py_XINCREF(trueSelf);
4547 { throw INTERP_KERNEL::Exception(msg); }
4551 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4553 std::vector<const MEDCouplingFieldDouble *> tmp;
4554 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4555 return MEDCouplingFieldDouble::MergeFields(tmp);
4558 static void WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
4560 std::vector<const MEDCouplingFieldDouble *> tmp;
4561 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4562 MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4567 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4570 int getNumberOfFields() const;
4571 MEDCouplingMultiFields *deepCpy() const;
4572 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4573 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4574 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4575 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4576 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4579 std::string __str__() const throw(INTERP_KERNEL::Exception)
4581 return self->simpleRepr();
4583 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4585 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4586 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4588 std::vector<MEDCouplingFieldDouble *> fs(sz);
4589 for(int i=0;i<sz;i++)
4590 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4591 return MEDCouplingMultiFields::New(fs);
4593 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4595 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4596 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4598 std::vector<MEDCouplingFieldDouble *> fs(sz);
4599 for(int i=0;i<sz;i++)
4600 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4601 return MEDCouplingMultiFields::New(fs);
4603 PyObject *getFields() const
4605 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4606 int sz=fields.size();
4607 PyObject *res = PyList_New(sz);
4608 for(int i=0;i<sz;i++)
4612 fields[i]->incrRef();
4613 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4617 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4622 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4624 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4628 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4631 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4633 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4635 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4637 PyObject *res = PyList_New(sz);
4638 for(int i=0;i<sz;i++)
4643 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4647 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4652 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4654 std::vector<int> refs;
4655 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4657 PyObject *res = PyList_New(sz);
4658 for(int i=0;i<sz;i++)
4663 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4667 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4671 PyObject *ret=PyTuple_New(2);
4672 PyTuple_SetItem(ret,0,res);
4673 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4676 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4678 std::vector<DataArrayDouble *> ms=self->getArrays();
4680 PyObject *res = PyList_New(sz);
4681 for(int i=0;i<sz;i++)
4686 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4690 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4695 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4697 std::vector< std::vector<int> > refs;
4698 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4700 PyObject *res = PyList_New(sz);
4701 PyObject *res2 = PyList_New(sz);
4702 for(int i=0;i<sz;i++)
4707 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4711 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4713 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4716 PyObject *ret=PyTuple_New(2);
4717 PyTuple_SetItem(ret,0,res);
4718 PyTuple_SetItem(ret,1,res2);
4724 class MEDCouplingDefinitionTime
4727 MEDCouplingDefinitionTime();
4728 void assign(const MEDCouplingDefinitionTime& other);
4729 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4730 double getTimeResolution() const;
4731 std::vector<double> getHotSpotsTime() const;
4734 std::string __str__() const throw(INTERP_KERNEL::Exception)
4736 std::ostringstream oss;
4737 self->appendRepr(oss);
4741 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4743 int meshId,arrId,arrIdInField,fieldId;
4744 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4745 PyObject *res=PyList_New(4);
4746 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4747 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4748 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4749 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4753 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4755 int meshId,arrId,arrIdInField,fieldId;
4756 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4757 PyObject *res=PyList_New(4);
4758 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4759 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4760 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4761 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4767 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4770 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4771 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4775 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4777 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4778 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4780 std::vector<MEDCouplingFieldDouble *> fs(sz);
4781 for(int i=0;i<sz;i++)
4782 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4783 return MEDCouplingFieldOverTime::New(fs);
4785 std::string __str__() const throw(INTERP_KERNEL::Exception)
4787 return self->simpleRepr();
4789 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4791 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4792 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4794 std::vector<MEDCouplingFieldDouble *> fs(sz);
4795 for(int i=0;i<sz;i++)
4796 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4797 return MEDCouplingFieldOverTime::New(fs);
4802 class MEDCouplingCartesianAMRMesh;
4804 class MEDCouplingCartesianAMRPatchGen : public RefCountObject
4807 int getNumberOfCellsRecursiveWithOverlap() const throw(INTERP_KERNEL::Exception);
4808 int getNumberOfCellsRecursiveWithoutOverlap() const throw(INTERP_KERNEL::Exception);
4809 int getMaxNumberOfLevelsRelativeToThis() const throw(INTERP_KERNEL::Exception);
4812 MEDCouplingCartesianAMRMeshGen *getMesh() const throw(INTERP_KERNEL::Exception)
4814 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
4822 class MEDCouplingCartesianAMRPatch : public MEDCouplingCartesianAMRPatchGen
4825 int getNumberOfOverlapedCellsForFather() const throw(INTERP_KERNEL::Exception);
4826 bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const throw(INTERP_KERNEL::Exception);
4827 std::vector<int> computeCellGridSt() const throw(INTERP_KERNEL::Exception);
4830 PyObject *getBLTRRange() const throw(INTERP_KERNEL::Exception)
4832 const std::vector< std::pair<int,int> >& ret(self->getBLTRRange());
4833 return convertFromVectorPairInt(ret);
4836 void addPatch(PyObject *bottomLeftTopRight, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception)
4838 std::vector< std::pair<int,int> > inp;
4839 convertPyToVectorPairInt(bottomLeftTopRight,inp);
4840 self->addPatch(inp,factors);
4843 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const throw(INTERP_KERNEL::Exception)
4845 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
4847 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatchGen.__getitem__ : no underlying mesh !");
4848 if(patchId==mesh->getNumberOfPatches())
4850 std::ostringstream oss;
4851 oss << "Requesting for patchId " << patchId << " having only " << mesh->getNumberOfPatches() << " patches !";
4852 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4855 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(mesh->getPatch(patchId)));
4861 void __delitem__(int patchId) throw(INTERP_KERNEL::Exception)
4863 MEDCouplingCartesianAMRMeshGen *mesh(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
4865 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__delitem__ : no underlying mesh !");
4866 mesh->removePatch(patchId);
4869 int __len__() const throw(INTERP_KERNEL::Exception)
4871 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
4873 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__len__ : no underlying mesh !");
4874 return mesh->getNumberOfPatches();
4879 class MEDCouplingCartesianAMRPatchGF : public MEDCouplingCartesianAMRPatchGen
4883 class MEDCouplingDataForGodFather : public RefCountObject
4886 virtual void synchronizeFineToCoarse() throw(INTERP_KERNEL::Exception);
4887 virtual void synchronizeCoarseToFine() throw(INTERP_KERNEL::Exception);
4888 virtual void synchronizeAllGhostZones() throw(INTERP_KERNEL::Exception);
4889 virtual void alloc() throw(INTERP_KERNEL::Exception);
4890 virtual void dealloc() throw(INTERP_KERNEL::Exception);
4893 class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel
4896 int getAbsoluteLevel() const throw(INTERP_KERNEL::Exception);
4897 int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
4898 const std::vector<int>& getFactors() const throw(INTERP_KERNEL::Exception);
4899 void setFactors(const std::vector<int>& newFactors) throw(INTERP_KERNEL::Exception);
4900 int getMaxNumberOfLevelsRelativeToThis() const throw(INTERP_KERNEL::Exception);
4901 int getNumberOfCellsAtCurrentLevel() const throw(INTERP_KERNEL::Exception);
4902 int getNumberOfCellsAtCurrentLevelGhost(int ghostLev) const throw(INTERP_KERNEL::Exception);
4903 int getNumberOfCellsRecursiveWithOverlap() const throw(INTERP_KERNEL::Exception);
4904 int getNumberOfCellsRecursiveWithoutOverlap() const throw(INTERP_KERNEL::Exception);
4905 bool isPatchInNeighborhoodOf(int patchId1, int patchId2, int ghostLev) const throw(INTERP_KERNEL::Exception);
4907 int getNumberOfPatches() const throw(INTERP_KERNEL::Exception);
4908 int getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const throw(INTERP_KERNEL::Exception);
4909 MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
4910 DataArrayDouble *extractGhostFrom(int ghostSz, const DataArrayDouble *arr) const throw(INTERP_KERNEL::Exception);
4911 std::vector<int> getPatchIdsInTheNeighborhoodOf(int patchId, int ghostLev) const throw(INTERP_KERNEL::Exception);
4912 MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const throw(INTERP_KERNEL::Exception);
4913 MEDCoupling1SGTUMesh *buildMeshOfDirectChildrenOnly() const throw(INTERP_KERNEL::Exception);
4914 void removeAllPatches() throw(INTERP_KERNEL::Exception);
4915 void removePatch(int patchId) throw(INTERP_KERNEL::Exception);
4916 void detachFromFather() throw(INTERP_KERNEL::Exception);
4917 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception);
4918 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector<int>& factors, double eps) throw(INTERP_KERNEL::Exception);
4919 DataArrayDouble *createCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis) const throw(INTERP_KERNEL::Exception);
4920 void fillCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch) const throw(INTERP_KERNEL::Exception);
4921 void fillCellFieldOnPatchGhost(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev) const throw(INTERP_KERNEL::Exception);
4922 void fillCellFieldOnPatchOnlyOnGhostZone(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev) const throw(INTERP_KERNEL::Exception);
4923 void fillCellFieldOnPatchOnlyOnGhostZoneWith(int ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const;
4924 void fillCellFieldComingFromPatch(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis) const throw(INTERP_KERNEL::Exception);
4925 void fillCellFieldComingFromPatchGhost(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, int ghostLev) const throw(INTERP_KERNEL::Exception);
4926 DataArrayInt *findPatchesInTheNeighborhoodOf(int patchId, int ghostLev) const throw(INTERP_KERNEL::Exception);
4929 void addPatch(PyObject *bottomLeftTopRight, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception)
4931 std::vector< std::pair<int,int> > inp;
4932 convertPyToVectorPairInt(bottomLeftTopRight,inp);
4933 self->addPatch(inp,factors);
4936 PyObject *getPatches() const throw(INTERP_KERNEL::Exception)
4938 std::vector< const MEDCouplingCartesianAMRPatch *> ps(self->getPatches());
4940 PyObject *ret = PyList_New(sz);
4941 for(int i=0;i<sz;i++)
4943 MEDCouplingCartesianAMRPatch *elt(const_cast<MEDCouplingCartesianAMRPatch *>(ps[i]));
4946 PyList_SetItem(ret,i,convertCartesianAMRPatch(elt, SWIG_POINTER_OWN | 0 ));
4951 void createPatchesFromCriterionML(PyObject *bso, const DataArrayDouble *criterion, PyObject *factors, double eps) throw(INTERP_KERNEL::Exception)
4953 std::vector<const INTERP_KERNEL::BoxSplittingOptions *> inp0;
4954 convertFromPyObjVectorOfObj<const INTERP_KERNEL::BoxSplittingOptions *>(bso,SWIGTYPE_p_INTERP_KERNEL__BoxSplittingOptions,"BoxSplittingOptions",inp0);
4955 std::vector< std::vector<int> > inp2;
4956 convertPyToVectorOfVectorOfInt(factors,inp2);
4957 self->createPatchesFromCriterionML(inp0,criterion,inp2,eps);
4960 PyObject *retrieveGridsAt(int absoluteLev) const throw(INTERP_KERNEL::Exception)
4962 std::vector<MEDCouplingCartesianAMRPatchGen *> ps(self->retrieveGridsAt(absoluteLev));
4964 PyObject *ret = PyList_New(sz);
4965 for(int i=0;i<sz;i++)
4966 PyList_SetItem(ret,i,convertCartesianAMRPatch(ps[i], SWIG_POINTER_OWN | 0 ));
4970 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(int ghostSz, PyObject *recurseArrs) const
4972 std::vector<const DataArrayDouble *> inp;
4973 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayDouble *>(recurseArrs,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",inp);
4974 return self->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostSz,inp);
4977 MEDCouplingCartesianAMRMeshGen *getFather() const throw(INTERP_KERNEL::Exception)
4979 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getFather()));
4985 MEDCouplingCartesianAMRMeshGen *getGodFather() const throw(INTERP_KERNEL::Exception)
4987 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getGodFather()));
4993 MEDCouplingCartesianAMRPatch *getPatch(int patchId) const throw(INTERP_KERNEL::Exception)
4995 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5001 MEDCouplingIMesh *getImageMesh() const throw(INTERP_KERNEL::Exception)
5003 const MEDCouplingIMesh *ret(self->getImageMesh());
5006 return const_cast<MEDCouplingIMesh *>(ret);
5009 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const throw(INTERP_KERNEL::Exception)
5011 if(patchId==self->getNumberOfPatches())
5013 std::ostringstream oss;
5014 oss << "Requesting for patchId " << patchId << " having only " << self->getNumberOfPatches() << " patches !";
5015 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5018 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5024 void fillCellFieldOnPatchGhostAdv(int patchId, const DataArrayDouble *cellFieldOnThis, int ghostLev, PyObject *arrsOnPatches) const throw(INTERP_KERNEL::Exception)
5026 std::vector<const ParaMEDMEM::DataArrayDouble *> arrsOnPatches2;
5027 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5028 self->fillCellFieldOnPatchGhostAdv(patchId,cellFieldOnThis,ghostLev,arrsOnPatches2);
5031 void fillCellFieldOnPatchOnlyGhostAdv(int patchId, int ghostLev, PyObject *arrsOnPatches) const
5033 std::vector<const ParaMEDMEM::DataArrayDouble *> arrsOnPatches2;
5034 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5035 self->fillCellFieldOnPatchOnlyGhostAdv(patchId,ghostLev,arrsOnPatches2);
5038 void __delitem__(int patchId) throw(INTERP_KERNEL::Exception)
5040 self->removePatch(patchId);
5043 int __len__() const throw(INTERP_KERNEL::Exception)
5045 return self->getNumberOfPatches();
5050 class MEDCouplingCartesianAMRMeshSub : public MEDCouplingCartesianAMRMeshGen
5054 class MEDCouplingCartesianAMRMesh : public MEDCouplingCartesianAMRMeshGen
5059 static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
5061 static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !";
5062 static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !";
5063 const int *nodeStrctPtr(0);
5064 const double *originPtr(0),*dxyzPtr(0);
5066 std::vector<int> bb0;
5067 nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
5070 std::vector<double> bb,bb2;
5072 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
5073 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
5075 return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
5078 MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
5080 return ParaMEDMEM_MEDCouplingCartesianAMRMesh_New(meshName,spaceDim,nodeStrct,origin,dxyz);
5085 class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel
5088 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception);
5089 MEDCouplingFieldDouble *buildCellFieldOnWithGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception);
5090 MEDCouplingFieldDouble *buildCellFieldOnWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception);
5091 bool changeGodFather(MEDCouplingCartesianAMRMesh *gf) throw(INTERP_KERNEL::Exception);
5094 static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, int ghostLev) throw(INTERP_KERNEL::Exception)
5096 std::vector< std::pair<std::string,int> > fieldNamesCpp0;
5097 std::vector< std::pair<std::string, std::vector<std::string> > > fieldNamesCpp1;
5098 MEDCouplingAMRAttribute *ret(0);
5101 convertPyToVectorPairStringInt(fieldNames,fieldNamesCpp0);
5102 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp0,ghostLev);
5104 catch(INTERP_KERNEL::Exception&)
5106 convertPyToVectorPairStringVecString(fieldNames,fieldNamesCpp1);
5107 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp1,ghostLev);
5112 MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, int ghostLev) throw(INTERP_KERNEL::Exception)
5114 return ParaMEDMEM_MEDCouplingAMRAttribute_New(gf,fieldNames,ghostLev);
5117 DataArrayDouble *getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception)
5119 const DataArrayDouble *ret(self->getFieldOn(mesh,fieldName));
5120 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
5126 void spillInfoOnComponents(PyObject *compNames) throw(INTERP_KERNEL::Exception)
5128 std::vector< std::vector<std::string> > compNamesCpp;
5129 convertPyToVectorOfVectorOfString(compNames,compNamesCpp);
5130 self->spillInfoOnComponents(compNamesCpp);
5133 PyObject *retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const throw(INTERP_KERNEL::Exception)
5135 std::vector<DataArrayDouble *> ret(self->retrieveFieldsOn(mesh));
5136 int sz((int)ret.size());
5137 PyObject *retPy(PyList_New(sz));
5138 for(int i=0;i<sz;i++)
5139 PyList_SetItem(retPy,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5145 class DenseMatrix : public RefCountObject, public TimeLabel
5148 static DenseMatrix *New(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
5149 static DenseMatrix *New(DataArrayDouble *array, int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
5150 DenseMatrix *deepCpy() const throw(INTERP_KERNEL::Exception);
5151 DenseMatrix *shallowCpy() const throw(INTERP_KERNEL::Exception);
5153 int getNumberOfRows() const throw(INTERP_KERNEL::Exception);
5154 int getNumberOfCols() const throw(INTERP_KERNEL::Exception);
5155 int getNbOfElems() const throw(INTERP_KERNEL::Exception);
5156 void reBuild(DataArrayDouble *array, int nbRows=-1, int nbCols=-1) throw(INTERP_KERNEL::Exception);
5157 void reShape(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
5158 void transpose() throw(INTERP_KERNEL::Exception);
5160 bool isEqual(const DenseMatrix& other, double eps) const throw(INTERP_KERNEL::Exception);
5161 DataArrayDouble *matVecMult(const DataArrayDouble *vec) const throw(INTERP_KERNEL::Exception);
5162 static DataArrayDouble *MatVecMult(const DenseMatrix *mat, const DataArrayDouble *vec) throw(INTERP_KERNEL::Exception);
5165 DenseMatrix(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception)
5167 return DenseMatrix::New(nbRows,nbCols);
5170 DenseMatrix(DataArrayDouble *array, int nbRows, int nbCols) throw(INTERP_KERNEL::Exception)
5172 return DenseMatrix::New(array,nbRows,nbCols);
5175 PyObject *isEqualIfNotWhy(const DenseMatrix& other, double eps) const throw(INTERP_KERNEL::Exception)
5178 bool ret0=self->isEqualIfNotWhy(other,eps,ret1);
5179 PyObject *ret=PyTuple_New(2);
5180 PyObject *ret0Py=ret0?Py_True:Py_False;
5182 PyTuple_SetItem(ret,0,ret0Py);
5183 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5187 DataArrayDouble *getData() throw(INTERP_KERNEL::Exception)
5189 DataArrayDouble *ret(self->getData());
5195 DenseMatrix *__add__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5197 return ParaMEDMEM::DenseMatrix::Add(self,other);
5200 DenseMatrix *__sub__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5202 return ParaMEDMEM::DenseMatrix::Substract(self,other);
5205 DenseMatrix *__mul__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5207 return ParaMEDMEM::DenseMatrix::Multiply(self,other);
5210 DenseMatrix *__mul__(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception)
5212 return ParaMEDMEM::DenseMatrix::Multiply(self,other);
5215 PyObject *___iadd___(PyObject *trueSelf, const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5217 self->addEqual(other);
5218 Py_XINCREF(trueSelf);
5222 PyObject *___isub___(PyObject *trueSelf, const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5224 self->substractEqual(other);
5225 Py_XINCREF(trueSelf);
5229 PyObject *toNumPyMatrix() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5231 PyObject *obj(ToNumPyArrayUnderground<DataArrayDouble,double>(self->getData(),NPY_DOUBLE,"DataArrayDouble",self->getNumberOfRows(),self->getNumberOfCols()));
5241 __filename=os.environ.get('PYTHONSTARTUP')
5242 if __filename and os.path.isfile(__filename):
5243 execfile(__filename)