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::orderConsecutiveCells1D;
299 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
300 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
301 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic;
302 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
303 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
304 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::New;
305 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::getNodalConnectivity;
306 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
307 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::New;
308 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
309 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::computeDualMesh;
310 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
311 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::sortHexa8EachOther;
312 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
313 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
314 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::New;
315 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
316 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
317 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
318 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
319 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
320 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
321 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::buildStructuredSubPart;
322 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTUnstructured;
323 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTSubLevelMesh;
324 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
325 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom;
326 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
327 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh;
328 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::ComputeCornersGhost;
329 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
330 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
331 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
332 %newobject ParaMEDMEM::MEDCouplingIMesh::New;
333 %newobject ParaMEDMEM::MEDCouplingIMesh::asSingleCell;
334 %newobject ParaMEDMEM::MEDCouplingIMesh::buildWithGhost;
335 %newobject ParaMEDMEM::MEDCouplingIMesh::convertToCartesian;
336 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
337 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
338 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
339 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
340 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
341 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
342 %newobject ParaMEDMEM::MEDCouplingCartesianAMRPatchGen::getMesh;
343 %newobject ParaMEDMEM::MEDCouplingCartesianAMRPatchGen::__getitem__;
344 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::deepCpy;
345 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::buildUnstructured;
346 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::extractGhostFrom;
347 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::buildMeshFromPatchEnvelop;
348 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::buildMeshOfDirectChildrenOnly;
349 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getImageMesh;
350 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getGodFather;
351 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getFather;
352 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getPatch;
353 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::createCellFieldOnPatch;
354 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::findPatchesInTheNeighborhoodOf;
355 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getPatchAtPosition;
356 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getMeshAtPosition;
357 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::__getitem__;
358 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::New;
359 %newobject ParaMEDMEM::MEDCouplingDataForGodFather::getMyGodFather;
360 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::New;
361 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::deepCpy;
362 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::deepCpyWithoutGodFather;
363 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::getFieldOn;
364 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::projectTo;
365 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::buildCellFieldOnRecurseWithoutOverlapWithoutGhost;
366 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::buildCellFieldOnWithGhost;
367 %newobject ParaMEDMEM::MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost;
368 %newobject ParaMEDMEM::DenseMatrix::New;
369 %newobject ParaMEDMEM::DenseMatrix::deepCpy;
370 %newobject ParaMEDMEM::DenseMatrix::shallowCpy;
371 %newobject ParaMEDMEM::DenseMatrix::getData;
372 %newobject ParaMEDMEM::DenseMatrix::matVecMult;
373 %newobject ParaMEDMEM::DenseMatrix::MatVecMult;
374 %newobject ParaMEDMEM::DenseMatrix::__add__;
375 %newobject ParaMEDMEM::DenseMatrix::__sub__;
376 %newobject ParaMEDMEM::DenseMatrix::__mul__;
378 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
379 %feature("unref") MEDCouplingMesh "$this->decrRef();"
380 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
381 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
382 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
383 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
384 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
385 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
386 %feature("unref") MEDCouplingIMesh "$this->decrRef();"
387 %feature("unref") MEDCouplingCurveLinearMesh "$this->decrRef();"
388 %feature("unref") MEDCouplingField "$this->decrRef();"
389 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
390 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
391 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
392 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
393 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
394 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
395 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
396 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
397 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
398 %feature("unref") MEDCouplingCartesianAMRMeshGen "$this->decrRef();"
399 %feature("unref") MEDCouplingCartesianAMRMesh "$this->decrRef();"
400 %feature("unref") MEDCouplingCartesianAMRMeshSub "$this->decrRef();"
401 %feature("unref") MEDCouplingCartesianAMRPatchGen "$this->decrRef();"
402 %feature("unref") MEDCouplingCartesianAMRPatchGF "$this->decrRef();"
403 %feature("unref") MEDCouplingCartesianAMRPatch "$this->decrRef();"
404 %feature("unref") MEDCouplingDataForGodFather "$this->decrRef();"
405 %feature("unref") MEDCouplingAMRAttribute "$this->decrRef();"
406 %feature("unref") DenseMatrix "$this->decrRef();"
408 %rename(assign) *::operator=;
409 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
410 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
411 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
412 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
416 %rename (InterpKernelException) INTERP_KERNEL::Exception;
418 %include "MEDCouplingRefCountObject.i"
419 %include "MEDCouplingMemArray.i"
421 namespace INTERP_KERNEL
424 * \class BoxSplittingOptions
425 * Class defining the options for box splitting used for AMR algorithm like creation of patches following a criterion.
427 class BoxSplittingOptions
430 BoxSplittingOptions();
431 void init() throw(INTERP_KERNEL::Exception);
432 double getEfficiencyGoal() const throw(INTERP_KERNEL::Exception);
433 void setEfficiencyGoal(double efficiency) throw(INTERP_KERNEL::Exception);
434 double getEfficiencyThreshold() const throw(INTERP_KERNEL::Exception);
435 void setEfficiencyThreshold(double efficiencyThreshold) throw(INTERP_KERNEL::Exception);
436 int getMinimumPatchLength() const throw(INTERP_KERNEL::Exception);
437 void setMinimumPatchLength(int minPatchLength) throw(INTERP_KERNEL::Exception);
438 int getMaximumPatchLength() const throw(INTERP_KERNEL::Exception);
439 void setMaximumPatchLength(int maxPatchLength) throw(INTERP_KERNEL::Exception);
440 int getMaximumNbOfCellsInPatch() const throw(INTERP_KERNEL::Exception);
441 void setMaximumNbOfCellsInPatch(int maxNbCellsInPatch) throw(INTERP_KERNEL::Exception);
442 void copyOptions(const BoxSplittingOptions & other) throw(INTERP_KERNEL::Exception);
443 std::string printOptions() const throw(INTERP_KERNEL::Exception);
446 std::string __str__() const throw(INTERP_KERNEL::Exception)
448 return self->printOptions();
470 CONST_ON_TIME_INTERVAL = 7
471 } TypeOfTimeDiscretization;
479 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
480 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
482 } MEDCouplingMeshType;
485 class DataArrayDouble;
486 class MEDCouplingUMesh;
487 class MEDCouplingFieldDouble;
489 %extend RefCountObject
491 std::string getHiddenCppPointer() const
493 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
498 %extend MEDCouplingGaussLocalization
500 std::string __str__() const throw(INTERP_KERNEL::Exception)
502 return self->getStringRepr();
505 std::string __repr__() const throw(INTERP_KERNEL::Exception)
507 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
508 oss << self->getStringRepr();
515 class MEDCouplingMesh : public RefCountObject, public TimeLabel
518 void setName(const std::string& name);
519 std::string getName() const;
520 void setDescription(const std::string& descr);
521 std::string getDescription() const;
522 void setTime(double val, int iteration, int order);
523 void setTimeUnit(const std::string& unit);
524 std::string getTimeUnit() const;
525 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
526 bool isStructured() const throw(INTERP_KERNEL::Exception);
527 virtual MEDCouplingMesh *deepCpy() const;
528 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
529 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
530 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
531 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
532 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
533 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
534 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
535 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
536 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
537 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
538 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
539 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
540 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
541 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
542 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
543 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
544 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
545 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
546 virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
547 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
548 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
549 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
550 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
551 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
552 std::string writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
553 virtual std::string getVTKFileExtension() const;
554 std::string getVTKFileNameOf(const std::string& fileName) const;
556 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
557 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
558 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
559 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
560 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception);
561 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
562 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
563 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
564 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
565 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
566 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
567 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
568 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
569 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
570 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
571 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
572 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
575 std::string __str__() const throw(INTERP_KERNEL::Exception)
577 return self->simpleRepr();
580 PyObject *getTime() throw(INTERP_KERNEL::Exception)
583 double tmp0=self->getTime(tmp1,tmp2);
584 PyObject *res = PyList_New(3);
585 PyList_SetItem(res,0,SWIG_From_double(tmp0));
586 PyList_SetItem(res,1,SWIG_From_int(tmp1));
587 PyList_SetItem(res,2,SWIG_From_int(tmp2));
591 int getCellContainingPoint(PyObject *p, 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::getCellContainingPoint : ";
600 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
601 return self->getCellContainingPoint(pos,eps);
604 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
608 DataArrayDoubleTuple *aa;
609 std::vector<double> bb;
611 int spaceDim=self->getSpaceDimension();
612 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
613 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
614 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
615 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
616 PyObject *ret=PyTuple_New(2);
617 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
618 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
622 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
624 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
625 int spaceDim=self->getSpaceDimension();
627 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
628 if (!SWIG_IsOK(res1))
631 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
632 int nbOfPoints=size/spaceDim;
635 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
637 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
641 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
643 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
644 da2->checkAllocated();
645 int size=da2->getNumberOfTuples();
646 int nbOfCompo=da2->getNumberOfComponents();
647 if(nbOfCompo!=spaceDim)
649 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
651 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
653 PyObject *ret=PyTuple_New(2);
654 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
655 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
659 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
663 DataArrayDoubleTuple *aa;
664 std::vector<double> bb;
666 int spaceDim=self->getSpaceDimension();
667 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
668 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
669 std::vector<int> elts;
670 self->getCellsContainingPoint(pos,eps,elts);
671 DataArrayInt *ret=DataArrayInt::New();
672 ret->alloc((int)elts.size(),1);
673 std::copy(elts.begin(),elts.end(),ret->getPointer());
674 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
677 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
679 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
680 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
681 self->getReverseNodalConnectivity(d0,d1);
682 PyObject *ret=PyTuple_New(2);
683 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
684 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
688 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
691 int v0; std::vector<int> v1;
692 const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
693 self->renumberCells(ids,check);
696 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
698 DataArrayInt *cellCor, *nodeCor;
699 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
700 PyObject *res = PyList_New(2);
701 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
702 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
706 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
708 DataArrayInt *cellCor=0,*nodeCor=0;
709 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
710 PyObject *res = PyList_New(2);
711 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
712 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
716 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
718 DataArrayInt *cellCor=0;
719 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
723 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
726 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
727 if (!SWIG_IsOK(res1))
730 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
731 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
735 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
737 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
738 da2->checkAllocated();
739 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
742 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
744 std::vector<int> conn;
745 self->getNodeIdsOfCell(cellId,conn);
746 return convertIntArrToPyList2(conn);
749 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
751 std::vector<double> coo;
752 self->getCoordinatesOfNode(nodeId,coo);
753 return convertDblArrToPyList2(coo);
756 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
760 DataArrayDoubleTuple *aa;
761 std::vector<double> bb;
763 int spaceDim=self->getSpaceDimension();
764 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
765 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
766 self->scale(pointPtr,factor);
769 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
771 int spaceDim=self->getSpaceDimension();
772 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
773 self->getBoundingBox(tmp);
774 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
778 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
781 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
782 PyObject *ret=PyTuple_New(2);
783 PyObject *ret0Py=ret0?Py_True:Py_False;
785 PyTuple_SetItem(ret,0,ret0Py);
786 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
790 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
792 int szArr,sw,iTypppArr;
793 std::vector<int> stdvecTyyppArr;
794 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
795 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
796 if(sw==3)//DataArrayInt
798 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
799 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
800 std::string name=argpt->getName();
802 ret->setName(name.c_str());
804 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
807 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
809 int szArr,sw,iTypppArr;
810 std::vector<int> stdvecTyyppArr;
812 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
813 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
814 if(sw==3)//DataArrayInt
816 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
817 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
818 std::string name=argpt->getName();
820 ret->setName(name.c_str());
823 PyObject *res = PyList_New(2);
824 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
825 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
826 PyList_SetItem(res,0,obj0);
827 PyList_SetItem(res,1,obj1);
831 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
835 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
836 PyObject *res = PyTuple_New(2);
837 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
840 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
842 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
843 PyTuple_SetItem(res,0,obj0);
844 PyTuple_SetItem(res,1,obj1);
848 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
850 std::vector<int> vals=self->getDistributionOfTypes();
852 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
853 PyObject *ret=PyList_New((int)vals.size()/3);
854 for(int j=0;j<(int)vals.size()/3;j++)
856 PyObject *ret1=PyList_New(3);
857 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
858 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
859 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
860 PyList_SetItem(ret,j,ret1);
865 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
867 std::vector<int> code;
868 std::vector<const DataArrayInt *> idsPerType;
869 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
870 convertPyToNewIntArr4(li,1,3,code);
871 return self->checkTypeConsistencyAndContig(code,idsPerType);
874 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
876 std::vector<int> code;
877 std::vector<DataArrayInt *> idsInPflPerType;
878 std::vector<DataArrayInt *> idsPerType;
879 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
880 PyObject *ret=PyTuple_New(3);
883 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
884 PyObject *ret0=PyList_New((int)code.size()/3);
885 for(int j=0;j<(int)code.size()/3;j++)
887 PyObject *ret00=PyList_New(3);
888 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
889 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
890 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
891 PyList_SetItem(ret0,j,ret00);
893 PyTuple_SetItem(ret,0,ret0);
895 PyObject *ret1=PyList_New(idsInPflPerType.size());
896 for(std::size_t j=0;j<idsInPflPerType.size();j++)
897 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
898 PyTuple_SetItem(ret,1,ret1);
899 int n=idsPerType.size();
900 PyObject *ret2=PyList_New(n);
902 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
903 PyTuple_SetItem(ret,2,ret2);
907 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
911 DataArrayDoubleTuple *aa;
912 std::vector<double> bb;
914 int spaceDim=self->getSpaceDimension();
915 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
916 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
917 self->translate(vectorPtr);
920 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
922 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
925 DataArrayDoubleTuple *aa;
926 std::vector<double> bb;
928 int spaceDim=self->getSpaceDimension();
929 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
930 self->rotate(centerPtr,0,alpha);
933 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
935 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
937 DataArrayDouble *a,*a2;
938 DataArrayDoubleTuple *aa,*aa2;
939 std::vector<double> bb,bb2;
941 int spaceDim=self->getSpaceDimension();
942 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
943 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
944 self->rotate(centerPtr,vectorPtr,alpha);
947 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
949 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
950 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
951 PyObject *res=PyList_New(result.size());
952 for(int i=0;iL!=result.end(); i++, iL++)
953 PyList_SetItem(res,i,PyInt_FromLong(*iL));
957 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
959 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
960 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
961 return MEDCouplingMesh::MergeMeshes(tmp);
967 //== MEDCouplingMesh End
969 %include "NormalizedGeometricTypes"
970 %include "MEDCouplingNatureOfFieldEnum"
974 class MEDCouplingNatureOfField
977 static const char *GetRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception);
978 static std::string GetReprNoThrow(NatureOfField nat);
979 static std::string GetAllPossibilitiesStr();
983 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
984 // include "MEDCouplingTimeDiscretization.i"
988 class MEDCouplingGaussLocalization
991 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
992 const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
993 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
994 INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
995 void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
996 int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
997 int getDimension() const throw(INTERP_KERNEL::Exception);
998 int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
999 std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
1000 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1001 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception);
1003 const std::vector<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
1004 double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
1005 const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
1006 double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
1007 const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
1008 double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
1009 void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
1010 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
1011 void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
1012 void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
1013 void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
1014 void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
1016 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
1020 %include "MEDCouplingFieldDiscretization.i"
1022 //== MEDCouplingPointSet
1024 namespace ParaMEDMEM
1026 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
1029 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
1030 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
1031 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
1032 void zipCoords() throw(INTERP_KERNEL::Exception);
1033 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
1034 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
1035 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
1036 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
1037 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
1038 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
1039 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
1040 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
1041 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
1042 static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception);
1043 virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
1044 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
1045 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
1046 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
1047 virtual DataArrayInt *findBoundaryNodes() const;
1048 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
1049 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
1050 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
1051 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
1052 virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
1053 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1056 std::string __str__() const throw(INTERP_KERNEL::Exception)
1058 return self->simpleRepr();
1061 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
1064 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1065 PyObject *res = PyList_New(2);
1066 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1067 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
1071 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
1073 DataArrayInt *comm, *commIndex;
1074 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1075 PyObject *res = PyList_New(2);
1076 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1077 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1081 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
1083 DataArrayDouble *ret1=self->getCoords();
1086 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
1089 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
1091 int szArr,sw,iTypppArr;
1092 std::vector<int> stdvecTyyppArr;
1093 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1094 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1095 if(sw==3)//DataArrayInt
1097 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1098 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1099 std::string name=argpt->getName();
1101 ret->setName(name.c_str());
1103 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1106 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1108 int szArr,sw,iTypppArr;
1109 std::vector<int> stdvecTyyppArr;
1110 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1111 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1112 if(sw==3)//DataArrayInt
1114 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1115 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1116 std::string name=argpt->getName();
1118 ret->setName(name.c_str());
1120 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1123 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
1125 int szArr,sw,iTypppArr;
1126 std::vector<int> stdvecTyyppArr;
1127 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1128 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1129 if(sw==3)//DataArrayInt
1131 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1132 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1133 std::string name=argpt->getName();
1135 ret->setName(name.c_str());
1137 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1140 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1142 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1143 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1146 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1148 int szArr,sw,iTypppArr;
1149 std::vector<int> stdvecTyyppArr;
1150 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1151 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1152 if(sw==3)//DataArrayInt
1154 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1155 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1156 std::string name=argpt->getName();
1158 ret->setName(name.c_str());
1160 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1163 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1165 int szArr,sw,iTypppArr;
1166 std::vector<int> stdvecTyyppArr;
1167 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1168 self->renumberNodes(tmp,newNbOfNodes);
1171 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1173 int szArr,sw,iTypppArr;
1174 std::vector<int> stdvecTyyppArr;
1175 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1176 self->renumberNodes2(tmp,newNbOfNodes);
1179 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1181 int spaceDim=self->getSpaceDimension();
1183 DataArrayDouble *a,*a2;
1184 DataArrayDoubleTuple *aa,*aa2;
1185 std::vector<double> bb,bb2;
1187 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1188 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1189 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1190 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1191 std::vector<int> nodes;
1192 self->findNodesOnLine(p,v,eps,nodes);
1193 DataArrayInt *ret=DataArrayInt::New();
1194 ret->alloc((int)nodes.size(),1);
1195 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1196 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1198 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1200 int spaceDim=self->getSpaceDimension();
1202 DataArrayDouble *a,*a2;
1203 DataArrayDoubleTuple *aa,*aa2;
1204 std::vector<double> bb,bb2;
1206 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1207 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1208 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1209 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1210 std::vector<int> nodes;
1211 self->findNodesOnPlane(p,v,eps,nodes);
1212 DataArrayInt *ret=DataArrayInt::New();
1213 ret->alloc((int)nodes.size(),1);
1214 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1215 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1218 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1222 DataArrayDoubleTuple *aa;
1223 std::vector<double> bb;
1225 int spaceDim=self->getSpaceDimension();
1226 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1227 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1228 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1229 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1232 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1234 DataArrayInt *c=0,*cI=0;
1238 DataArrayDoubleTuple *aa;
1239 std::vector<double> bb;
1241 int spaceDim=self->getSpaceDimension();
1242 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1243 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1244 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1245 PyObject *ret=PyTuple_New(2);
1246 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1247 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1251 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1253 DataArrayInt *c=0,*cI=0;
1254 int spaceDim=self->getSpaceDimension();
1257 DataArrayDoubleTuple *aa;
1258 std::vector<double> bb;
1261 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1262 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1264 PyObject *ret=PyTuple_New(2);
1265 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1266 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1270 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1274 DataArrayDoubleTuple *aa;
1275 std::vector<double> bb;
1277 int spaceDim=self->getSpaceDimension();
1278 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1279 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1281 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1282 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1285 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1289 std::vector<int> multiVal;
1290 std::pair<int, std::pair<int,int> > slic;
1291 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1292 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1296 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1298 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1300 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1302 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1306 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1308 DataArrayInt *v0=0,*v1=0;
1309 self->findCommonCells(compType,startCellId,v0,v1);
1310 PyObject *res = PyList_New(2);
1311 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1312 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1317 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1320 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1321 if (!SWIG_IsOK(res1))
1324 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1325 self->renumberNodesInConn(tmp);
1329 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1331 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1332 da2->checkAllocated();
1333 self->renumberNodesInConn(da2->getConstPointer());
1337 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1340 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1341 PyObject *ret=PyTuple_New(2);
1342 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1343 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1347 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1349 DataArrayInt *ret=0;
1351 int szArr,sw,iTypppArr;
1352 std::vector<int> stdvecTyyppArr;
1353 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1354 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1358 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1362 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1363 PyObject *res = PyList_New(3);
1364 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1365 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1366 PyList_SetItem(res,2,SWIG_From_int(ret2));
1370 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1374 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1375 PyObject *res = PyList_New(3);
1376 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1377 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1378 PyList_SetItem(res,2,SWIG_From_int(ret2));
1382 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1385 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1386 if (!SWIG_IsOK(res1))
1389 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1390 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1394 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1396 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1397 da2->checkAllocated();
1398 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1402 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1406 std::vector<int> multiVal;
1407 std::pair<int, std::pair<int,int> > slic;
1408 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1409 int nbc=self->getNumberOfCells();
1410 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1417 std::ostringstream oss;
1418 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1419 throw INTERP_KERNEL::Exception(oss.str().c_str());
1422 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1427 int tmp=nbc+singleVal;
1428 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1432 std::ostringstream oss;
1433 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1434 throw INTERP_KERNEL::Exception(oss.str().c_str());
1440 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1444 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1449 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1450 daIntTyypp->checkAllocated();
1451 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1454 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1458 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1461 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1462 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1463 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1464 for(int i=0;i<sz;i++)
1465 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1468 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1471 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1473 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1474 std::vector<double> val3;
1475 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1476 "Rotate2DAlg",2,true,nbNodes);
1478 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1479 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1482 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1485 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1486 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1487 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1488 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1489 for(int i=0;i<sz;i++)
1490 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1493 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1496 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1498 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1499 std::vector<double> val3;
1500 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1501 "Rotate3DAlg",3,true,nbNodes);
1503 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1504 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1505 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1510 //== MEDCouplingPointSet End
1512 class MEDCouplingUMeshCell
1515 INTERP_KERNEL::NormalizedCellType getType() const;
1518 std::string __str__() const throw(INTERP_KERNEL::Exception)
1520 return self->repr();
1523 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1526 const int *r=self->getAllConn(ret2);
1527 PyObject *ret=PyTuple_New(ret2);
1528 for(int i=0;i<ret2;i++)
1529 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1535 class MEDCouplingUMeshCellIterator
1542 MEDCouplingUMeshCell *ret=self->nextt();
1544 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1547 PyErr_SetString(PyExc_StopIteration,"No more data.");
1554 class MEDCouplingUMeshCellByTypeIterator
1557 ~MEDCouplingUMeshCellByTypeIterator();
1562 MEDCouplingUMeshCellEntry *ret=self->nextt();
1564 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1567 PyErr_SetString(PyExc_StopIteration,"No more data.");
1574 class MEDCouplingUMeshCellByTypeEntry
1577 ~MEDCouplingUMeshCellByTypeEntry();
1580 MEDCouplingUMeshCellByTypeIterator *__iter__()
1582 return self->iterator();
1587 class MEDCouplingUMeshCellEntry
1590 INTERP_KERNEL::NormalizedCellType getType() const;
1591 int getNumberOfElems() const;
1594 MEDCouplingUMeshCellIterator *__iter__()
1596 return self->iterator();
1601 //== MEDCouplingUMesh
1603 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1606 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1607 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1608 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1609 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1610 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1611 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1612 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1613 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1614 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1615 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1616 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1617 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1618 void computeTypes() throw(INTERP_KERNEL::Exception);
1619 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1620 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1622 DataArrayInt *conformize2D(double eps) throw(INTERP_KERNEL::Exception);
1623 DataArrayInt *colinearize2D(double eps) throw(INTERP_KERNEL::Exception);
1624 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1625 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1626 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1627 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1628 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1629 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1630 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1631 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1632 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1633 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1634 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1635 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1636 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1637 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1638 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1639 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1640 bool isFullyQuadratic() const throw(INTERP_KERNEL::Exception);
1641 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1642 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1643 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1644 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1645 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1646 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1647 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1648 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1649 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1650 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1651 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1652 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1653 DataArrayDouble *computePlaneEquationOf3DFaces() const throw(INTERP_KERNEL::Exception);
1654 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1655 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1656 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1657 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1658 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1659 DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1660 DataArrayInt *buildUnionOf2DMesh() const throw(INTERP_KERNEL::Exception);
1661 DataArrayInt *buildUnionOf3DMesh() const throw(INTERP_KERNEL::Exception);
1662 DataArrayInt *orderConsecutiveCells1D() const throw(INTERP_KERNEL::Exception);
1663 DataArrayDouble *getBoundingBoxForBBTreeFast() const throw(INTERP_KERNEL::Exception);
1664 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1665 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1666 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);
1667 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1668 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1669 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1670 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1671 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1673 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1675 return MEDCouplingUMesh::New();
1678 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1680 return MEDCouplingUMesh::New(meshName,meshDim);
1683 std::string __str__() const throw(INTERP_KERNEL::Exception)
1685 return self->simpleRepr();
1688 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1690 std::ostringstream oss;
1691 self->reprQuickOverview(oss);
1695 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1697 return self->cellIterator();
1700 PyObject *getAllGeoTypesSorted() const throw(INTERP_KERNEL::Exception)
1702 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
1703 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1704 PyObject *res=PyList_New(result.size());
1705 for(int i=0;iL!=result.end(); i++, iL++)
1706 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1710 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1714 std::vector<int> multiVal;
1715 std::pair<int, std::pair<int,int> > slic;
1716 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1717 int nbc=self->getNumberOfCells();
1718 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1725 std::ostringstream oss;
1726 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1727 throw INTERP_KERNEL::Exception(oss.str().c_str());
1731 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1738 int tmp=nbc+singleVal;
1739 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1744 std::ostringstream oss;
1745 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1746 throw INTERP_KERNEL::Exception(oss.str().c_str());
1752 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1758 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1759 daIntTyypp->checkAllocated();
1760 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1764 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1768 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1772 std::vector<int> multiVal;
1773 std::pair<int, std::pair<int,int> > slic;
1774 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1775 int nbc=self->getNumberOfCells();
1776 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1783 std::ostringstream oss;
1784 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1785 throw INTERP_KERNEL::Exception(oss.str().c_str());
1789 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1796 int tmp=nbc+singleVal;
1797 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1802 std::ostringstream oss;
1803 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1804 throw INTERP_KERNEL::Exception(oss.str().c_str());
1810 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1815 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1821 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1822 daIntTyypp->checkAllocated();
1823 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1827 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1831 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1833 int szArr,sw,iTypppArr;
1834 std::vector<int> stdvecTyyppArr;
1835 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1838 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1839 throw INTERP_KERNEL::Exception(oss.str().c_str());
1841 self->insertNextCell(type,size,tmp);
1844 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1846 int szArr,sw,iTypppArr;
1847 std::vector<int> stdvecTyyppArr;
1848 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1849 self->insertNextCell(type,szArr,tmp);
1852 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1854 DataArrayInt *ret=self->getNodalConnectivity();
1859 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1861 DataArrayInt *ret=self->getNodalConnectivityIndex();
1867 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1869 int szArr,sw,iTypppArr;
1870 std::vector<int> stdvecTyyppArr;
1871 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1872 int nbOfDepthPeelingPerformed=0;
1873 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1874 PyObject *res=PyTuple_New(2);
1875 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1876 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1880 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1882 DataArrayInt *v0=0,*v1=0;
1883 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1884 PyObject *res = PyList_New(2);
1885 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1886 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1890 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1894 DataArrayDoubleTuple *aa;
1895 std::vector<double> bb;
1897 int nbOfCompo=self->getSpaceDimension();
1898 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1901 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1902 PyObject *ret=PyTuple_New(2);
1903 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1904 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1908 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1910 DataArrayInt *ret1=0;
1911 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1912 PyObject *ret=PyTuple_New(2);
1913 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1914 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1918 PyObject *tetrahedrize(int policy) throw(INTERP_KERNEL::Exception)
1921 DataArrayInt *ret1(0);
1922 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
1923 PyObject *ret=PyTuple_New(3);
1924 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
1925 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1926 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
1930 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1932 std::vector<int> cells;
1933 self->checkButterflyCells(cells,eps);
1934 DataArrayInt *ret=DataArrayInt::New();
1935 ret->alloc((int)cells.size(),1);
1936 std::copy(cells.begin(),cells.end(),ret->getPointer());
1937 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1940 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1942 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1944 PyObject *ret = PyList_New(sz);
1945 for(int i=0;i<sz;i++)
1946 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1950 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1952 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1953 int sz=retCpp.size();
1954 PyObject *ret=PyList_New(sz);
1955 for(int i=0;i<sz;i++)
1956 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1960 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1963 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1964 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1965 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1968 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1971 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1972 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1976 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1979 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1980 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1984 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1986 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1987 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1988 PyObject *ret=PyTuple_New(3);
1989 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1990 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1991 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1995 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1997 DataArrayInt *tmp0=0,*tmp1=0;
1998 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1999 PyObject *ret=PyTuple_New(2);
2000 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2001 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2005 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
2009 std::vector<int> multiVal;
2010 std::pair<int, std::pair<int,int> > slic;
2011 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2012 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2016 return self->duplicateNodes(&singleVal,&singleVal+1);
2018 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
2020 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
2022 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2026 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
2030 std::vector<int> multiVal;
2031 std::pair<int, std::pair<int,int> > slic;
2032 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2033 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2037 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
2039 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
2041 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
2043 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2047 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
2050 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
2051 DataArrayInt *tmp0,*tmp1=0;
2052 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2053 PyObject *ret=PyTuple_New(2);
2054 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2055 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2059 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const throw(INTERP_KERNEL::Exception)
2061 DataArrayInt *ret0=0,*ret1=0;
2062 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
2063 PyObject *ret=PyTuple_New(2);
2064 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2065 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2069 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2071 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2072 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2073 DataArrayInt *ret1=0,*ret2=0;
2074 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2075 PyObject *ret=PyTuple_New(3);
2076 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2077 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2078 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2082 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2084 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2085 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2086 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2087 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2090 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
2093 std::vector<const MEDCouplingUMesh *> meshes;
2094 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2095 std::vector<DataArrayInt *> corr;
2096 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2098 PyObject *ret1=PyList_New(sz);
2099 for(int i=0;i<sz;i++)
2100 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2101 PyObject *ret=PyList_New(2);
2102 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2103 PyList_SetItem(ret,1,ret1);
2107 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2109 std::vector<MEDCouplingUMesh *> meshes;
2110 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2111 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2114 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
2116 std::vector<MEDCouplingUMesh *> meshes;
2117 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2118 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2121 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
2125 std::vector<int> multiVal;
2126 std::pair<int, std::pair<int,int> > slic;
2127 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2129 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2130 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2134 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2136 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2138 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2140 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2144 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2146 DataArrayInt *arrOut=0,*arrIndexOut=0;
2149 std::vector<int> multiVal;
2150 std::pair<int, std::pair<int,int> > slic;
2151 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2153 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2154 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2159 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2164 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2169 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2173 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2175 PyObject *ret=PyTuple_New(2);
2176 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2177 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2181 static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2183 DataArrayInt *arrOut=0,*arrIndexOut=0;
2184 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2185 PyObject *ret=PyTuple_New(2);
2186 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2187 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2191 static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2193 if(!PySlice_Check(slic))
2194 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !");
2195 Py_ssize_t strt=2,stp=2,step=2;
2196 PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
2198 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !");
2199 arrIndxIn->checkAllocated();
2200 if(arrIndxIn->getNumberOfComponents()!=1)
2201 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !");
2202 GetIndicesOfSlice(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !");
2203 DataArrayInt *arrOut=0,*arrIndexOut=0;
2204 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2205 PyObject *ret=PyTuple_New(2);
2206 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2207 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2211 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2212 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2213 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2215 DataArrayInt *arrOut=0,*arrIndexOut=0;
2218 std::vector<int> multiVal;
2219 std::pair<int, std::pair<int,int> > slic;
2220 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2222 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2223 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2228 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2233 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2238 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2242 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2244 PyObject *ret=PyTuple_New(2);
2245 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2246 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2250 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2251 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2255 std::vector<int> multiVal;
2256 std::pair<int, std::pair<int,int> > slic;
2257 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2259 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2260 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2265 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2270 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2275 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2279 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2283 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2287 DataArrayDoubleTuple *aa;
2288 std::vector<double> bb;
2290 int spaceDim=self->getSpaceDimension();
2291 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2292 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2294 std::vector<int> cells;
2295 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2296 DataArrayInt *ret=DataArrayInt::New();
2297 ret->alloc((int)cells.size(),1);
2298 std::copy(cells.begin(),cells.end(),ret->getPointer());
2299 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2302 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2306 DataArrayDoubleTuple *aa;
2307 std::vector<double> bb;
2309 int spaceDim=self->getSpaceDimension();
2310 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2311 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2312 self->orientCorrectly2DCells(v,polyOnly);
2315 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2317 std::vector<int> cells;
2318 self->arePolyhedronsNotCorrectlyOriented(cells);
2319 DataArrayInt *ret=DataArrayInt::New();
2320 ret->alloc((int)cells.size(),1);
2321 std::copy(cells.begin(),cells.end(),ret->getPointer());
2322 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2325 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2329 self->getFastAveragePlaneOfThis(vec,pos);
2331 std::copy(vec,vec+3,vals);
2332 std::copy(pos,pos+3,vals+3);
2333 return convertDblArrToPyListOfTuple(vals,3,2);
2336 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2338 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2339 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2340 return MEDCouplingUMesh::MergeUMeshes(tmp);
2343 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2346 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2347 PyObject *ret=PyTuple_New(2);
2348 PyObject *ret0Py=ret0?Py_True:Py_False;
2350 PyTuple_SetItem(ret,0,ret0Py);
2351 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2355 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2358 bool ret0=self->areCellsIncludedIn2(other,ret1);
2359 PyObject *ret=PyTuple_New(2);
2360 PyObject *ret0Py=ret0?Py_True:Py_False;
2362 PyTuple_SetItem(ret,0,ret0Py);
2363 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2367 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2369 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2370 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2371 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2372 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2373 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2374 PyObject *ret=PyTuple_New(5);
2375 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2376 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2377 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2378 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2379 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2383 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2385 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2386 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2387 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2388 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2389 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2390 PyObject *ret=PyTuple_New(5);
2391 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2392 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2393 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2394 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2395 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2399 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2401 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2402 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2403 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2404 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2405 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2406 PyObject *ret=PyTuple_New(5);
2407 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2408 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2409 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2410 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2411 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2415 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2417 DataArrayInt *neighbors=0,*neighborsIdx=0;
2418 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2419 PyObject *ret=PyTuple_New(2);
2420 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2421 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2425 PyObject *computeNeighborsOfNodes() const throw(INTERP_KERNEL::Exception)
2427 DataArrayInt *neighbors=0,*neighborsIdx=0;
2428 self->computeNeighborsOfNodes(neighbors,neighborsIdx);
2429 PyObject *ret=PyTuple_New(2);
2430 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2431 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2435 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2437 DataArrayInt *neighbors=0,*neighborsIdx=0;
2438 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2439 PyObject *ret=PyTuple_New(2);
2440 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2441 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2445 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2447 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2448 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2449 DataArrayInt *d2,*d3,*d4,*dd5;
2450 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2451 PyObject *ret=PyTuple_New(7);
2452 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2453 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2454 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2455 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2456 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2457 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2458 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2462 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2465 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2466 da->checkAllocated();
2467 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2470 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2473 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2474 da->checkAllocated();
2475 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2478 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2481 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2482 da->checkAllocated();
2483 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2486 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2489 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2490 da->checkAllocated();
2491 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2492 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2493 PyObject *res = PyList_New(result.size());
2494 for (int i=0;iL!=result.end(); i++, iL++)
2495 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2499 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2502 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2503 da->checkAllocated();
2504 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2505 ret->setName(da->getName().c_str());
2509 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2511 DataArrayInt *cellNb1=0,*cellNb2=0;
2512 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2513 PyObject *ret=PyTuple_New(3);
2514 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2515 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2516 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2520 static PyObject *Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, const MEDCouplingUMesh *mesh1D, double eps) throw(INTERP_KERNEL::Exception)
2522 MEDCouplingUMesh *splitMesh2D(0),*splitMesh1D(0);
2523 DataArrayInt *cellIdInMesh2D(0),*cellIdInMesh1D(0);
2524 MEDCouplingUMesh::Intersect2DMeshWith1DLine(mesh2D,mesh1D,eps,splitMesh2D,splitMesh1D,cellIdInMesh2D,cellIdInMesh1D);
2525 PyObject *ret(PyTuple_New(4));
2526 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh2D),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2527 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh1D),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2528 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh2D),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2529 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh1D),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2533 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2535 int spaceDim=self->getSpaceDimension();
2537 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2539 DataArrayDouble *a,*a2;
2540 DataArrayDoubleTuple *aa,*aa2;
2541 std::vector<double> bb,bb2;
2543 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2544 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2545 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2546 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2548 DataArrayInt *cellIds=0;
2549 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2550 PyObject *ret=PyTuple_New(2);
2551 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2552 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2556 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2558 int spaceDim=self->getSpaceDimension();
2560 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2562 DataArrayDouble *a,*a2;
2563 DataArrayDoubleTuple *aa,*aa2;
2564 std::vector<double> bb,bb2;
2566 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2567 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2568 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2569 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2571 DataArrayInt *cellIds=0;
2572 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2573 PyObject *ret=PyTuple_New(2);
2574 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2575 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2579 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2581 int spaceDim=self->getSpaceDimension();
2583 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2585 DataArrayDouble *a,*a2;
2586 DataArrayDoubleTuple *aa,*aa2;
2587 std::vector<double> bb,bb2;
2589 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2590 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2591 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2592 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2593 return self->getCellIdsCrossingPlane(orig,vect,eps);
2596 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2600 std::vector<int> pos2;
2601 DataArrayInt *pos3=0;
2602 DataArrayIntTuple *pos4=0;
2603 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2608 self->convertToPolyTypes(&pos1,&pos1+1);
2615 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2620 self->convertToPolyTypes(pos3->begin(),pos3->end());
2624 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2628 void convertAllToPoly();
2629 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2630 bool unPolyze() throw(INTERP_KERNEL::Exception);
2631 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2632 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2633 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2636 //== MEDCouplingUMesh End
2638 //== MEDCouplingExtrudedMesh
2640 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2643 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2644 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2646 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2648 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2651 std::string __str__() const throw(INTERP_KERNEL::Exception)
2653 return self->simpleRepr();
2656 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2658 std::ostringstream oss;
2659 self->reprQuickOverview(oss);
2663 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2665 MEDCouplingUMesh *ret=self->getMesh2D();
2668 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2670 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2672 MEDCouplingUMesh *ret=self->getMesh1D();
2675 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2677 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2679 DataArrayInt *ret=self->getMesh3DIds();
2682 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2687 //== MEDCouplingExtrudedMesh End
2689 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2692 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2693 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2694 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2695 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2696 virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2697 virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
2700 virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2702 int szArr,sw,iTypppArr;
2703 std::vector<int> stdvecTyyppArr;
2704 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2705 self->insertNextCell(tmp,tmp+szArr);
2708 virtual DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2710 DataArrayInt *ret=self->getNodalConnectivity();
2711 if(ret) ret->incrRef();
2715 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2717 std::vector< const MEDCoupling1GTUMesh *> parts;
2718 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
2719 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
2724 //== MEDCoupling1SGTUMesh
2726 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2729 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2730 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2731 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2732 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2733 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2734 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2735 MEDCoupling1GTUMesh *computeDualMesh() const throw(INTERP_KERNEL::Exception);
2736 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const throw(INTERP_KERNEL::Exception);
2737 DataArrayInt *sortHexa8EachOther() throw(INTERP_KERNEL::Exception);
2740 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2742 return MEDCoupling1SGTUMesh::New(name,type);
2745 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2747 return MEDCoupling1SGTUMesh::New(m);
2750 std::string __str__() const throw(INTERP_KERNEL::Exception)
2752 return self->simpleRepr();
2755 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2757 std::ostringstream oss;
2758 self->reprQuickOverview(oss);
2762 PyObject *structurizeMe(double eps=1e-12) const throw(INTERP_KERNEL::Exception)
2764 DataArrayInt *cellPerm(0),*nodePerm(0);
2765 MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps));
2766 PyObject *ret(PyTuple_New(3));
2767 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 ));
2768 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2769 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2773 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2775 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2776 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2777 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2780 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2782 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2783 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2784 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2789 //== MEDCoupling1SGTUMesh End
2791 //== MEDCoupling1DGTUMesh
2793 class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2796 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2797 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2798 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
2799 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2800 bool isPacked() const throw(INTERP_KERNEL::Exception);
2803 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2805 return MEDCoupling1DGTUMesh::New(name,type);
2808 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2810 return MEDCoupling1DGTUMesh::New(m);
2813 std::string __str__() const throw(INTERP_KERNEL::Exception)
2815 return self->simpleRepr();
2818 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2820 std::ostringstream oss;
2821 self->reprQuickOverview(oss);
2825 DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
2827 DataArrayInt *ret=self->getNodalConnectivityIndex();
2828 if(ret) ret->incrRef();
2832 PyObject *retrievePackedNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2834 DataArrayInt *ret1=0,*ret2=0;
2835 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
2836 PyObject *ret0Py=ret0?Py_True:Py_False;
2838 PyObject *ret=PyTuple_New(3);
2839 PyTuple_SetItem(ret,0,ret0Py);
2840 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2841 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2845 PyObject *copyWithNodalConnectivityPacked() const throw(INTERP_KERNEL::Exception)
2848 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
2849 PyObject *ret=PyTuple_New(2);
2850 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
2851 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
2852 PyTuple_SetItem(ret,1,ret1Py);
2856 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2858 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2859 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2860 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
2863 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2865 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2866 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2867 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
2870 static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt) throw(INTERP_KERNEL::Exception)
2872 std::vector<const ParaMEDMEM::DataArrayInt *> tmp;
2873 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2874 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
2879 //== MEDCoupling1DGTUMeshEnd
2881 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2884 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2885 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2886 int getNumberOfCellsOfSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2887 int getSpaceDimensionOnNodeStruct() const throw(INTERP_KERNEL::Exception);
2888 double computeSquareness() const throw(INTERP_KERNEL::Exception);
2889 virtual std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2890 std::vector<int> getCellGridStructure() const throw(INTERP_KERNEL::Exception);
2891 MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception);
2892 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
2893 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2894 static int DeduceNumberOfGivenStructure(const std::vector<int>& st) throw(INTERP_KERNEL::Exception);
2895 static DataArrayInt *ComputeCornersGhost(const std::vector<int>& st, int ghostLev) throw(INTERP_KERNEL::Exception);
2896 static std::vector<int> GetSplitVectFromStruct(const std::vector<int>& strct) throw(INTERP_KERNEL::Exception);
2899 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const throw(INTERP_KERNEL::Exception)
2901 int tmpp1=-1,tmpp2=-1;
2902 std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
2903 std::vector< std::pair<int,int> > inp;
2907 for(int i=0;i<tmpp1;i++)
2908 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2913 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
2914 inp.resize(tmpp1/2);
2915 for(int i=0;i<tmpp1/2;i++)
2916 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2919 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
2920 return self->buildStructuredSubPart(inp);
2923 static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) throw(INTERP_KERNEL::Exception)
2925 std::vector< std::pair<int,int> > inp;
2926 convertPyToVectorPairInt(part,inp);
2928 int szArr,sw,iTypppArr;
2929 std::vector<int> stdvecTyyppArr;
2930 const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
2931 std::vector<int> tmp5(tmp4,tmp4+szArr);
2933 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
2936 static void MultiplyPartOf(const std::vector<int>& st, PyObject *part, double factor, DataArrayDouble *da) throw(INTERP_KERNEL::Exception)
2938 std::vector< std::pair<int,int> > inp;
2939 convertPyToVectorPairInt(part,inp);
2940 MEDCouplingStructuredMesh::MultiplyPartOf(st,inp,factor,da);
2943 static void MultiplyPartOfByGhost(const std::vector<int>& st, PyObject *part, int ghostSize, double factor, DataArrayDouble *da) throw(INTERP_KERNEL::Exception)
2945 std::vector< std::pair<int,int> > inp;
2946 convertPyToVectorPairInt(part,inp);
2947 MEDCouplingStructuredMesh::MultiplyPartOfByGhost(st,inp,ghostSize,factor,da);
2950 static PyObject *PutInGhostFormat(int ghostSize, const std::vector<int>& st, PyObject *part) throw(INTERP_KERNEL::Exception)
2952 std::vector< std::pair<int,int> > inp;
2953 convertPyToVectorPairInt(part,inp);
2954 std::vector<int> stWithGhost;
2955 std::vector< std::pair<int,int> > partWithGhost;
2956 MEDCouplingStructuredMesh::PutInGhostFormat(ghostSize,st,inp,stWithGhost,partWithGhost);
2957 PyObject *ret(PyTuple_New(2));
2958 PyTuple_SetItem(ret,0,convertIntArrToPyList2(stWithGhost));
2959 PyTuple_SetItem(ret,1,convertFromVectorPairInt(partWithGhost));
2963 static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector<int>& st, const DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat) throw(INTERP_KERNEL::Exception)
2965 std::vector< std::pair<int,int> > inp;
2966 convertPyToVectorPairInt(partCompactFormat,inp);
2967 return MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,fieldOfDbl,inp);
2970 static void AssignPartOfFieldOfDoubleUsing(const std::vector<int>& st, DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat, const DataArrayDouble *other) throw(INTERP_KERNEL::Exception)
2972 std::vector< std::pair<int,int> > inp;
2973 convertPyToVectorPairInt(partCompactFormat,inp);
2974 MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(st,fieldOfDbl,inp,other);
2977 static int DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part) throw(INTERP_KERNEL::Exception)
2979 std::vector< std::pair<int,int> > inp;
2980 convertPyToVectorPairInt(part,inp);
2981 return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp);
2984 static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) throw(INTERP_KERNEL::Exception)
2986 int szArr,sw,iTypppArr;
2987 std::vector<int> stdvecTyyppArr;
2988 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2989 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
2992 static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2994 int szArr,sw,iTypppArr;
2995 std::vector<int> stdvecTyyppArr;
2996 const int *tmp(convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr));
2997 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
3000 static std::vector<int> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat) throw(INTERP_KERNEL::Exception)
3002 std::vector< std::pair<int,int> > inp;
3003 convertPyToVectorPairInt(partCompactFormat,inp);
3004 return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp);
3007 static PyObject *GetCompactFrmtFromDimensions(const std::vector<int>& dims) throw(INTERP_KERNEL::Exception)
3009 std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dims));
3010 PyObject *retPy=PyList_New(ret.size());
3011 for(std::size_t i=0;i<ret.size();i++)
3013 PyObject *tmp=PyTuple_New(2);
3014 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3015 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3016 PyList_SetItem(retPy,i,tmp);
3021 static PyObject *IntersectRanges(PyObject *r1, PyObject *r2) throw(INTERP_KERNEL::Exception)
3023 std::vector< std::pair<int,int> > r1Cpp,r2Cpp;
3024 convertPyToVectorPairInt(r1,r1Cpp);
3025 convertPyToVectorPairInt(r2,r2Cpp);
3026 std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::IntersectRanges(r1Cpp,r2Cpp));
3027 PyObject *retPy=PyList_New(ret.size());
3028 for(std::size_t i=0;i<ret.size();i++)
3030 PyObject *tmp=PyTuple_New(2);
3031 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3032 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3033 PyList_SetItem(retPy,i,tmp);
3038 static bool AreRangesIntersect(PyObject *r1, PyObject *r2)
3040 std::vector< std::pair<int,int> > r1Cpp,r2Cpp;
3041 convertPyToVectorPairInt(r1,r1Cpp);
3042 convertPyToVectorPairInt(r2,r2Cpp);
3043 return MEDCouplingStructuredMesh::AreRangesIntersect(r1Cpp,r2Cpp);
3046 static PyObject *IsPartStructured(PyObject *li, PyObject *st) throw(INTERP_KERNEL::Exception)
3048 int szArr,sw,iTypppArr;
3049 std::vector<int> stdvecTyyppArr;
3050 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3051 int szArr2,sw2,iTypppArr2;
3052 std::vector<int> stdvecTyyppArr2;
3053 const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
3054 std::vector<int> tmp3(tmp2,tmp2+szArr2);
3055 std::vector< std::pair<int,int> > partCompactFormat;
3056 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
3057 PyObject *ret=PyTuple_New(2);
3058 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
3059 PyTuple_SetItem(ret,0,ret0Py);
3060 PyObject *ret1Py=PyList_New(partCompactFormat.size());
3061 for(std::size_t i=0;i<partCompactFormat.size();i++)
3063 PyObject *tmp4=PyTuple_New(2);
3064 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
3065 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
3066 PyList_SetItem(ret1Py,i,tmp4);
3068 PyTuple_SetItem(ret,1,ret1Py);
3072 static PyObject *ChangeReferenceFromGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigInAbs, bool check=true) throw(INTERP_KERNEL::Exception)
3074 std::vector< std::pair<int,int> > param0,param1,ret;
3075 convertPyToVectorPairInt(bigInAbs,param0);
3076 convertPyToVectorPairInt(partOfBigInAbs,param1);
3077 MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(param0,param1,ret,check);
3078 PyObject *retPy(PyList_New(ret.size()));
3079 for(std::size_t i=0;i<ret.size();i++)
3081 PyObject *tmp(PyTuple_New(2));
3082 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3083 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3084 PyList_SetItem(retPy,i,tmp);
3089 static PyObject *TranslateCompactFrmt(PyObject *part, const std::vector<int>& translation) throw(INTERP_KERNEL::Exception)
3091 std::vector< std::pair<int,int> > param0;
3092 convertPyToVectorPairInt(part,param0);
3093 std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::TranslateCompactFrmt(param0,translation));
3094 PyObject *retPy(PyList_New(ret.size()));
3095 for(std::size_t i=0;i<ret.size();i++)
3097 PyObject *tmp(PyTuple_New(2));
3098 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3099 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3100 PyList_SetItem(retPy,i,tmp);
3105 static std::vector<int> FindTranslationFrom(PyObject *startingFrom, PyObject *goingTo) throw(INTERP_KERNEL::Exception)
3107 std::vector< std::pair<int,int> > param0,param1;
3108 convertPyToVectorPairInt(startingFrom,param0);
3109 convertPyToVectorPairInt(goingTo,param1);
3110 return MEDCouplingStructuredMesh::FindTranslationFrom(param0,param1);
3113 static PyObject *ChangeReferenceToGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigRelativeToBig, bool check=true) throw(INTERP_KERNEL::Exception)
3115 std::vector< std::pair<int,int> > param0,param1,ret;
3116 convertPyToVectorPairInt(bigInAbs,param0);
3117 convertPyToVectorPairInt(partOfBigRelativeToBig,param1);
3118 MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(param0,param1,ret,check);
3119 PyObject *retPy(PyList_New(ret.size()));
3120 for(std::size_t i=0;i<ret.size();i++)
3122 PyObject *tmp(PyTuple_New(2));
3123 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3124 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3125 PyList_SetItem(retPy,i,tmp);
3132 //== MEDCouplingCMesh
3134 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3137 static MEDCouplingCMesh *New() throw(INTERP_KERNEL::Exception);
3138 static MEDCouplingCMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
3139 MEDCouplingCMesh *clone(bool recDeepCpy) const;
3140 void setCoords(const DataArrayDouble *coordsX,
3141 const DataArrayDouble *coordsY=0,
3142 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
3143 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
3145 MEDCouplingCMesh() throw(INTERP_KERNEL::Exception)
3147 return MEDCouplingCMesh::New();
3149 MEDCouplingCMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
3151 return MEDCouplingCMesh::New(meshName);
3153 std::string __str__() const throw(INTERP_KERNEL::Exception)
3155 return self->simpleRepr();
3157 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3159 std::ostringstream oss;
3160 self->reprQuickOverview(oss);
3163 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
3165 DataArrayDouble *ret=self->getCoordsAt(i);
3173 //== MEDCouplingCMesh End
3175 //== MEDCouplingCurveLinearMesh
3177 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3180 static MEDCouplingCurveLinearMesh *New() throw(INTERP_KERNEL::Exception);
3181 static MEDCouplingCurveLinearMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
3182 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
3183 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
3185 MEDCouplingCurveLinearMesh() throw(INTERP_KERNEL::Exception)
3187 return MEDCouplingCurveLinearMesh::New();
3189 MEDCouplingCurveLinearMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
3191 return MEDCouplingCurveLinearMesh::New(meshName);
3193 std::string __str__() const throw(INTERP_KERNEL::Exception)
3195 return self->simpleRepr();
3197 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3199 std::ostringstream oss;
3200 self->reprQuickOverview(oss);
3203 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
3205 DataArrayDouble *ret=self->getCoords();
3210 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
3212 int szArr,sw,iTypppArr;
3213 std::vector<int> stdvecTyyppArr;
3214 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
3215 self->setNodeGridStructure(tmp,tmp+szArr);
3220 //== MEDCouplingCurveLinearMesh End
3222 //== MEDCouplingIMesh
3224 class MEDCouplingIMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3227 static MEDCouplingIMesh *New() throw(INTERP_KERNEL::Exception);
3229 void setSpaceDimension(int spaceDim) throw(INTERP_KERNEL::Exception);
3230 std::vector<int> getNodeStruct() const throw(INTERP_KERNEL::Exception);
3231 std::vector<double> getOrigin() const throw(INTERP_KERNEL::Exception);
3232 std::vector<double> getDXYZ() const throw(INTERP_KERNEL::Exception);
3233 void setAxisUnit(const std::string& unitName) throw(INTERP_KERNEL::Exception);
3234 std::string getAxisUnit() const throw(INTERP_KERNEL::Exception);
3235 double getMeasureOfAnyCell() const throw(INTERP_KERNEL::Exception);
3236 MEDCouplingCMesh *convertToCartesian() const throw(INTERP_KERNEL::Exception);
3237 void refineWithFactor(const std::vector<int>& factors) throw(INTERP_KERNEL::Exception);
3238 MEDCouplingIMesh *asSingleCell() const throw(INTERP_KERNEL::Exception);
3239 MEDCouplingIMesh *buildWithGhost(int ghostLev) const throw(INTERP_KERNEL::Exception);
3244 return MEDCouplingIMesh::New();
3246 static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3248 static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
3249 static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
3250 const int *nodeStrctPtr(0);
3251 const double *originPtr(0),*dxyzPtr(0);
3253 std::vector<int> bb0;
3254 nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
3257 std::vector<double> bb,bb2;
3259 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
3260 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
3262 return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
3265 MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3267 return ParaMEDMEM_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
3270 void setNodeStruct(PyObject *nodeStrct) throw(INTERP_KERNEL::Exception)
3273 std::vector<int> bb0;
3274 const int *nodeStrctPtr(convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0));
3275 self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
3278 void setOrigin(PyObject *origin) throw(INTERP_KERNEL::Exception)
3280 static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3283 DataArrayDoubleTuple *aa;
3284 std::vector<double> bb;
3286 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
3287 self->setOrigin(originPtr,originPtr+nbTuples);
3290 void setDXYZ(PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3292 static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3295 DataArrayDoubleTuple *aa;
3296 std::vector<double> bb;
3298 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
3299 self->setDXYZ(originPtr,originPtr+nbTuples);
3302 static void CondenseFineToCoarse(const std::vector<int>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, DataArrayDouble *coarseDA) throw(INTERP_KERNEL::Exception)
3304 std::vector< std::pair<int,int> > inp;
3305 convertPyToVectorPairInt(fineLocInCoarse,inp);
3306 MEDCouplingIMesh::CondenseFineToCoarse(coarseSt,fineDA,inp,facts,coarseDA);
3309 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)
3311 std::vector< std::pair<int,int> > inp;
3312 convertPyToVectorPairInt(fineLocInCoarse,inp);
3313 MEDCouplingIMesh::CondenseFineToCoarseGhost(coarseSt,fineDA,inp,facts,coarseDA,ghostSize);
3316 static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts) throw(INTERP_KERNEL::Exception)
3318 std::vector< std::pair<int,int> > inp;
3319 convertPyToVectorPairInt(fineLocInCoarse,inp);
3320 MEDCouplingIMesh::SpreadCoarseToFine(coarseDA,coarseSt,fineDA,inp,facts);
3323 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)
3325 std::vector< std::pair<int,int> > inp;
3326 convertPyToVectorPairInt(fineLocInCoarse,inp);
3327 MEDCouplingIMesh::SpreadCoarseToFineGhost(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3330 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)
3332 std::vector< std::pair<int,int> > inp;
3333 convertPyToVectorPairInt(fineLocInCoarse,inp);
3334 MEDCouplingIMesh::SpreadCoarseToFineGhostZone(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3337 std::string __str__() const throw(INTERP_KERNEL::Exception)
3339 return self->simpleRepr();
3341 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3343 std::ostringstream oss;
3344 self->reprQuickOverview(oss);
3350 //== MEDCouplingIMesh End
3354 namespace ParaMEDMEM
3356 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
3359 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
3360 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
3361 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3362 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3363 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
3364 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
3365 void setName(const char *name) throw(INTERP_KERNEL::Exception);
3366 std::string getDescription() const throw(INTERP_KERNEL::Exception);
3367 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
3368 std::string getName() const throw(INTERP_KERNEL::Exception);
3369 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
3370 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
3371 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
3372 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
3373 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
3374 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
3375 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
3376 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3377 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
3378 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
3379 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
3380 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
3381 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
3382 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
3383 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
3384 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3386 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
3388 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3391 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3394 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
3396 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3399 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3402 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
3404 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
3405 return convertIntArrToPyList3(ret);
3408 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
3411 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
3412 PyObject *ret=PyTuple_New(2);
3413 PyObject *ret0Py=ret0?Py_True:Py_False;
3415 PyTuple_SetItem(ret,0,ret0Py);
3416 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3420 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
3422 DataArrayInt *ret1=0;
3423 MEDCouplingMesh *ret0=0;
3425 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3426 if (!SWIG_IsOK(res1))
3429 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3430 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3434 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3436 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3437 da2->checkAllocated();
3438 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3440 PyObject *res = PyList_New(2);
3441 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3442 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3446 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
3448 DataArrayInt *ret1=0;
3450 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3451 PyObject *res=PyTuple_New(2);
3452 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3454 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3457 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3458 PyTuple_SetItem(res,1,res1);
3463 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3466 int v0; std::vector<int> v1;
3467 const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
3468 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3471 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3472 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3475 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3476 if (!SWIG_IsOK(res1))
3479 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3480 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3484 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3486 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3487 da2->checkAllocated();
3488 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3492 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3494 std::vector<int> tmp;
3495 self->getCellIdsHavingGaussLocalization(locId,tmp);
3496 DataArrayInt *ret=DataArrayInt::New();
3497 ret->alloc((int)tmp.size(),1);
3498 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3499 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3502 int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
3504 std::vector<int> inp0;
3505 convertPyToNewIntArr4(code,1,3,inp0);
3506 std::vector<const DataArrayInt *> inp1;
3507 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(idsPerType,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",inp1);
3508 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3513 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3516 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3517 static MEDCouplingFieldTemplate *New(TypeOfField type);
3518 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3519 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3522 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3524 return MEDCouplingFieldTemplate::New(f);
3527 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3529 return MEDCouplingFieldTemplate::New(type);
3532 std::string __str__() const throw(INTERP_KERNEL::Exception)
3534 return self->simpleRepr();
3537 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3539 std::ostringstream oss;
3540 self->reprQuickOverview(oss);
3546 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3549 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3550 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3551 void setTimeUnit(const std::string& unit);
3552 std::string getTimeUnit() const;
3553 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3554 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3555 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3556 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3557 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3558 std::string writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
3559 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3560 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3561 MEDCouplingFieldDouble *deepCpy() const;
3562 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3563 MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
3564 MEDCouplingFieldDouble *cellToNodeDiscretization() const throw(INTERP_KERNEL::Exception);
3565 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3566 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3567 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3568 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3569 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3570 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3571 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3572 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3573 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3574 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3575 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
3576 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3577 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3578 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3579 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3580 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3581 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3582 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3583 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3584 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3585 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3586 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3587 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3588 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3589 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3590 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3591 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3592 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3593 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3594 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3595 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3596 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3597 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3598 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3599 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3600 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3601 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3602 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3603 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3604 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3605 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3606 void fillFromAnalytic(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3607 void fillFromAnalytic2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3608 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3609 void applyFunc(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3610 void applyFunc2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3611 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3612 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3613 void applyFunc(const std::string& func) throw(INTERP_KERNEL::Exception);
3614 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
3615 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
3616 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3617 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3618 double getMinValue() const throw(INTERP_KERNEL::Exception);
3619 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3620 double norm2() const throw(INTERP_KERNEL::Exception);
3621 double normMax() const throw(INTERP_KERNEL::Exception);
3622 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3623 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3624 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3625 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3626 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3627 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3628 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3629 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3630 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3631 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3632 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3633 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3634 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3635 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3636 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3637 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3638 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3639 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3640 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3641 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3642 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3643 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3645 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3647 return MEDCouplingFieldDouble::New(type,td);
3650 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3652 return MEDCouplingFieldDouble::New(ft,td);
3655 std::string __str__() const throw(INTERP_KERNEL::Exception)
3657 return self->simpleRepr();
3660 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3662 std::ostringstream oss;
3663 self->reprQuickOverview(oss);
3667 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3669 DataArrayDouble *ret=self->getArray();
3675 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3677 std::vector<DataArrayDouble *> arrs=self->getArrays();
3678 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3682 PyObject *ret=PyTuple_New(sz);
3683 for(int i=0;i<sz;i++)
3686 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3688 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3693 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3695 std::vector<const DataArrayDouble *> tmp;
3696 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3698 std::vector<DataArrayDouble *> arrs(sz);
3699 for(int i=0;i<sz;i++)
3700 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3701 self->setArrays(arrs);
3704 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3706 DataArrayDouble *ret=self->getEndArray();
3712 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3716 DataArrayDoubleTuple *aa;
3717 std::vector<double> bb;
3719 const MEDCouplingMesh *mesh=self->getMesh();
3721 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3722 int spaceDim=mesh->getSpaceDimension();
3723 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3724 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3726 int sz=self->getNumberOfComponents();
3727 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3728 self->getValueOn(spaceLoc,res);
3729 return convertDblArrToPyList(res,sz);
3732 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3734 int sz=self->getNumberOfComponents();
3735 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3736 self->getValueOnPos(i,j,k,res);
3737 return convertDblArrToPyList(res,sz);
3740 DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
3742 const MEDCouplingMesh *mesh(self->getMesh());
3744 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3747 double v0; ParaMEDMEM::DataArrayDouble *v1(0); ParaMEDMEM::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
3748 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
3749 mesh->getSpaceDimension(),true,nbPts);
3750 return self->getValueOnMulti(inp,nbPts);
3753 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3757 DataArrayDoubleTuple *aa;
3758 std::vector<double> bb;
3760 const MEDCouplingMesh *mesh=self->getMesh();
3762 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3763 int spaceDim=mesh->getSpaceDimension();
3764 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3765 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3768 int sz=self->getNumberOfComponents();
3769 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3770 self->getValueOn(spaceLoc,time,res);
3771 return convertDblArrToPyList(res,sz);
3774 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3776 if(self->getArray()!=0)
3777 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3780 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3781 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3782 self->setArray(arr);
3786 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3789 double tmp0=self->getTime(tmp1,tmp2);
3790 PyObject *res = PyList_New(3);
3791 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3792 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3793 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3797 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3800 double tmp0=self->getStartTime(tmp1,tmp2);
3801 PyObject *res = PyList_New(3);
3802 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3803 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3804 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3808 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3811 double tmp0=self->getEndTime(tmp1,tmp2);
3812 PyObject *res = PyList_New(3);
3813 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3814 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3815 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3818 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3820 int sz=self->getNumberOfComponents();
3821 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3822 self->accumulate(tmp);
3823 return convertDblArrToPyList(tmp,sz);
3825 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3827 int sz=self->getNumberOfComponents();
3828 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3829 self->integral(isWAbs,tmp);
3830 return convertDblArrToPyList(tmp,sz);
3832 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3834 int sz=self->getNumberOfComponents();
3835 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3836 self->getWeightedAverageValue(tmp,isWAbs);
3837 return convertDblArrToPyList(tmp,sz);
3839 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3841 int sz=self->getNumberOfComponents();
3842 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3844 return convertDblArrToPyList(tmp,sz);
3846 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3848 int sz=self->getNumberOfComponents();
3849 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3851 return convertDblArrToPyList(tmp,sz);
3853 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3855 int szArr,sw,iTypppArr;
3856 std::vector<int> stdvecTyyppArr;
3857 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3858 self->renumberCells(tmp,check);
3861 void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3863 int szArr,sw,iTypppArr;
3864 std::vector<int> stdvecTyyppArr;
3865 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3866 self->renumberCellsWithoutMesh(tmp,check);
3869 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3871 int szArr,sw,iTypppArr;
3872 std::vector<int> stdvecTyyppArr;
3873 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3874 self->renumberNodes(tmp,eps);
3877 void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3879 int szArr,sw,iTypppArr;
3880 std::vector<int> stdvecTyyppArr;
3881 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3882 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
3885 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3889 std::vector<int> multiVal;
3890 std::pair<int, std::pair<int,int> > slic;
3891 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3892 const MEDCouplingMesh *mesh=self->getMesh();
3894 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3895 int nbc=mesh->getNumberOfCells();
3896 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3903 std::ostringstream oss;
3904 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3905 throw INTERP_KERNEL::Exception(oss.str().c_str());
3908 return self->buildSubPart(&singleVal,&singleVal+1);
3913 int tmp=nbc+singleVal;
3914 return self->buildSubPart(&tmp,&tmp+1);
3918 std::ostringstream oss;
3919 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3920 throw INTERP_KERNEL::Exception(oss.str().c_str());
3926 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3930 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3935 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3936 daIntTyypp->checkAllocated();
3937 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3940 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3944 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3946 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";
3947 if(PyTuple_Check(li))
3949 Py_ssize_t sz=PyTuple_Size(li);
3951 throw INTERP_KERNEL::Exception(msg);
3952 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3955 std::vector<int> multiVal;
3956 std::pair<int, std::pair<int,int> > slic;
3957 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3958 if(!self->getArray())
3959 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3961 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3962 catch(INTERP_KERNEL::Exception& e)
3963 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3964 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3965 DataArrayDouble *ret0Arr=ret0->getArray();
3967 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3972 std::vector<int> v2(1,singleVal);
3973 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr(ret0Arr->keepSelectedComponents(v2));
3974 ret0->setArray(aarr);
3979 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr(ret0Arr->keepSelectedComponents(multiVal));
3980 ret0->setArray(aarr);
3985 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3986 std::vector<int> v2(nbOfComp);
3987 for(int i=0;i<nbOfComp;i++)
3988 v2[i]=slic.first+i*slic.second.second;
3989 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr(ret0Arr->keepSelectedComponents(v2));
3990 ret0->setArray(aarr);
3994 throw INTERP_KERNEL::Exception(msg);
3999 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
4002 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
4005 double r1=self->getMaxValue2(tmp);
4006 PyObject *ret=PyTuple_New(2);
4007 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4008 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4012 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
4015 double r1=self->getMinValue2(tmp);
4016 PyObject *ret=PyTuple_New(2);
4017 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
4018 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4022 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
4024 std::vector<int> tmp;
4025 convertPyToNewIntArr3(li,tmp);
4026 return self->keepSelectedComponents(tmp);
4029 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
4031 std::vector<int> tmp;
4032 convertPyToNewIntArr3(li,tmp);
4033 self->setSelectedComponents(f,tmp);
4036 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
4039 DataArrayDouble *a,*a2;
4040 DataArrayDoubleTuple *aa,*aa2;
4041 std::vector<double> bb,bb2;
4044 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
4045 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
4046 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
4047 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
4049 return self->extractSlice3D(orig,vect,eps);
4052 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4054 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
4057 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4059 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
4062 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4064 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.";
4065 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
4068 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4070 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4072 return (*self)-(*other);
4074 throw INTERP_KERNEL::Exception(msg);
4079 DataArrayDoubleTuple *aa;
4080 std::vector<double> bb;
4082 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4087 if(!self->getArray())
4088 throw INTERP_KERNEL::Exception(msg2);
4089 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
4090 ret->applyLin(1.,-val);
4091 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4092 ret2->setArray(ret);
4097 if(!self->getArray())
4098 throw INTERP_KERNEL::Exception(msg2);
4099 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
4100 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4101 ret2->setArray(ret);
4106 if(!self->getArray())
4107 throw INTERP_KERNEL::Exception(msg2);
4108 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4109 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4110 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4111 ret2->setArray(ret);
4116 if(!self->getArray())
4117 throw INTERP_KERNEL::Exception(msg2);
4118 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4119 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4120 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4121 ret2->setArray(ret);
4125 { throw INTERP_KERNEL::Exception(msg); }
4129 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4131 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
4134 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4136 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
4139 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4141 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
4144 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4146 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.";
4147 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
4150 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4152 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4154 return (*self)/(*other);
4156 throw INTERP_KERNEL::Exception(msg);
4161 DataArrayDoubleTuple *aa;
4162 std::vector<double> bb;
4164 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4170 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
4171 if(!self->getArray())
4172 throw INTERP_KERNEL::Exception(msg2);
4173 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
4174 ret->applyLin(1./val,0);
4175 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4176 ret2->setArray(ret);
4181 if(!self->getArray())
4182 throw INTERP_KERNEL::Exception(msg2);
4183 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
4184 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4185 ret2->setArray(ret);
4190 if(!self->getArray())
4191 throw INTERP_KERNEL::Exception(msg2);
4192 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4193 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4194 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4195 ret2->setArray(ret);
4200 if(!self->getArray())
4201 throw INTERP_KERNEL::Exception(msg2);
4202 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4203 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4204 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4205 ret2->setArray(ret);
4209 { throw INTERP_KERNEL::Exception(msg); }
4213 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4215 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
4218 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4220 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.";
4221 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
4224 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4226 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4228 return (*self)^(*other);
4230 throw INTERP_KERNEL::Exception(msg);
4235 DataArrayDoubleTuple *aa;
4236 std::vector<double> bb;
4238 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4243 if(!self->getArray())
4244 throw INTERP_KERNEL::Exception(msg2);
4245 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
4247 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4248 ret2->setArray(ret);
4253 if(!self->getArray())
4254 throw INTERP_KERNEL::Exception(msg2);
4255 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
4256 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4257 ret2->setArray(ret);
4262 if(!self->getArray())
4263 throw INTERP_KERNEL::Exception(msg2);
4264 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4265 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4266 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4267 ret2->setArray(ret);
4272 if(!self->getArray())
4273 throw INTERP_KERNEL::Exception(msg2);
4274 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4275 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4276 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4277 ret2->setArray(ret);
4281 { throw INTERP_KERNEL::Exception(msg); }
4285 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
4287 return self->negate();
4290 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4292 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.";
4293 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
4296 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4298 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4302 Py_XINCREF(trueSelf);
4306 throw INTERP_KERNEL::Exception(msg);
4311 DataArrayDoubleTuple *aa;
4312 std::vector<double> bb;
4314 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4319 if(!self->getArray())
4320 throw INTERP_KERNEL::Exception(msg2);
4321 self->getArray()->applyLin(1.,val);
4322 Py_XINCREF(trueSelf);
4327 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4330 Py_XINCREF(trueSelf);
4335 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4336 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4337 ret2->setArray(aaa);
4339 Py_XINCREF(trueSelf);
4344 if(!self->getArray())
4345 throw INTERP_KERNEL::Exception(msg2);
4346 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4347 self->getArray()->addEqual(aaa);
4348 Py_XINCREF(trueSelf);
4352 { throw INTERP_KERNEL::Exception(msg); }
4356 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4358 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.";
4359 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4362 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4364 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4368 Py_XINCREF(trueSelf);
4372 throw INTERP_KERNEL::Exception(msg);
4377 DataArrayDoubleTuple *aa;
4378 std::vector<double> bb;
4380 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4385 if(!self->getArray())
4386 throw INTERP_KERNEL::Exception(msg2);
4387 self->getArray()->applyLin(1.,-val);
4388 Py_XINCREF(trueSelf);
4393 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4396 Py_XINCREF(trueSelf);
4401 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4402 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4403 ret2->setArray(aaa);
4405 Py_XINCREF(trueSelf);
4410 if(!self->getArray())
4411 throw INTERP_KERNEL::Exception(msg2);
4412 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4413 self->getArray()->substractEqual(aaa);
4414 Py_XINCREF(trueSelf);
4418 { throw INTERP_KERNEL::Exception(msg); }
4422 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4424 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.";
4425 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4428 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4430 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4434 Py_XINCREF(trueSelf);
4438 throw INTERP_KERNEL::Exception(msg);
4443 DataArrayDoubleTuple *aa;
4444 std::vector<double> bb;
4446 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4451 if(!self->getArray())
4452 throw INTERP_KERNEL::Exception(msg2);
4453 self->getArray()->applyLin(val,0);
4454 Py_XINCREF(trueSelf);
4459 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4462 Py_XINCREF(trueSelf);
4467 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4468 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4469 ret2->setArray(aaa);
4471 Py_XINCREF(trueSelf);
4476 if(!self->getArray())
4477 throw INTERP_KERNEL::Exception(msg2);
4478 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4479 self->getArray()->multiplyEqual(aaa);
4480 Py_XINCREF(trueSelf);
4484 { throw INTERP_KERNEL::Exception(msg); }
4488 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4490 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.";
4491 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4494 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4496 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4500 Py_XINCREF(trueSelf);
4504 throw INTERP_KERNEL::Exception(msg);
4509 DataArrayDoubleTuple *aa;
4510 std::vector<double> bb;
4512 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4518 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4519 if(!self->getArray())
4520 throw INTERP_KERNEL::Exception(msg2);
4521 self->getArray()->applyLin(1./val,0);
4522 Py_XINCREF(trueSelf);
4527 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4530 Py_XINCREF(trueSelf);
4535 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4536 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4537 ret2->setArray(aaa);
4539 Py_XINCREF(trueSelf);
4544 if(!self->getArray())
4545 throw INTERP_KERNEL::Exception(msg2);
4546 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4547 self->getArray()->divideEqual(aaa);
4548 Py_XINCREF(trueSelf);
4552 { throw INTERP_KERNEL::Exception(msg); }
4556 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4558 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.";
4559 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4562 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4564 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4568 Py_XINCREF(trueSelf);
4572 throw INTERP_KERNEL::Exception(msg);
4577 DataArrayDoubleTuple *aa;
4578 std::vector<double> bb;
4580 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4585 if(!self->getArray())
4586 throw INTERP_KERNEL::Exception(msg2);
4587 self->getArray()->applyPow(val);
4588 Py_XINCREF(trueSelf);
4593 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4596 Py_XINCREF(trueSelf);
4601 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4602 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4603 ret2->setArray(aaa);
4605 Py_XINCREF(trueSelf);
4610 if(!self->getArray())
4611 throw INTERP_KERNEL::Exception(msg2);
4612 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4613 self->getArray()->powEqual(aaa);
4614 Py_XINCREF(trueSelf);
4618 { throw INTERP_KERNEL::Exception(msg); }
4622 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4624 std::vector<const MEDCouplingFieldDouble *> tmp;
4625 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4626 return MEDCouplingFieldDouble::MergeFields(tmp);
4629 static std::string WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
4631 std::vector<const MEDCouplingFieldDouble *> tmp;
4632 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4633 return MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4638 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4641 int getNumberOfFields() const;
4642 MEDCouplingMultiFields *deepCpy() const;
4643 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4644 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4645 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4646 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4647 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4650 std::string __str__() const throw(INTERP_KERNEL::Exception)
4652 return self->simpleRepr();
4654 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4656 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4657 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4659 std::vector<MEDCouplingFieldDouble *> fs(sz);
4660 for(int i=0;i<sz;i++)
4661 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4662 return MEDCouplingMultiFields::New(fs);
4664 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4666 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4667 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4669 std::vector<MEDCouplingFieldDouble *> fs(sz);
4670 for(int i=0;i<sz;i++)
4671 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4672 return MEDCouplingMultiFields::New(fs);
4674 PyObject *getFields() const
4676 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4677 int sz=fields.size();
4678 PyObject *res = PyList_New(sz);
4679 for(int i=0;i<sz;i++)
4683 fields[i]->incrRef();
4684 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4688 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4693 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4695 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4699 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4702 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4704 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4706 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4708 PyObject *res = PyList_New(sz);
4709 for(int i=0;i<sz;i++)
4714 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4718 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4723 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4725 std::vector<int> refs;
4726 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4728 PyObject *res = PyList_New(sz);
4729 for(int i=0;i<sz;i++)
4734 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4738 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4742 PyObject *ret=PyTuple_New(2);
4743 PyTuple_SetItem(ret,0,res);
4744 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4747 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4749 std::vector<DataArrayDouble *> ms=self->getArrays();
4751 PyObject *res = PyList_New(sz);
4752 for(int i=0;i<sz;i++)
4757 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4761 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4766 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4768 std::vector< std::vector<int> > refs;
4769 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4771 PyObject *res = PyList_New(sz);
4772 PyObject *res2 = PyList_New(sz);
4773 for(int i=0;i<sz;i++)
4778 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4782 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4784 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4787 PyObject *ret=PyTuple_New(2);
4788 PyTuple_SetItem(ret,0,res);
4789 PyTuple_SetItem(ret,1,res2);
4795 class MEDCouplingDefinitionTime
4798 MEDCouplingDefinitionTime();
4799 void assign(const MEDCouplingDefinitionTime& other);
4800 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4801 double getTimeResolution() const;
4802 std::vector<double> getHotSpotsTime() const;
4805 std::string __str__() const throw(INTERP_KERNEL::Exception)
4807 std::ostringstream oss;
4808 self->appendRepr(oss);
4812 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4814 int meshId,arrId,arrIdInField,fieldId;
4815 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4816 PyObject *res=PyList_New(4);
4817 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4818 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4819 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4820 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4824 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4826 int meshId,arrId,arrIdInField,fieldId;
4827 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4828 PyObject *res=PyList_New(4);
4829 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4830 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4831 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4832 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4838 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4841 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4842 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4846 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4848 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4849 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4851 std::vector<MEDCouplingFieldDouble *> fs(sz);
4852 for(int i=0;i<sz;i++)
4853 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4854 return MEDCouplingFieldOverTime::New(fs);
4856 std::string __str__() const throw(INTERP_KERNEL::Exception)
4858 return self->simpleRepr();
4860 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4862 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4863 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4865 std::vector<MEDCouplingFieldDouble *> fs(sz);
4866 for(int i=0;i<sz;i++)
4867 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4868 return MEDCouplingFieldOverTime::New(fs);
4873 class MEDCouplingCartesianAMRMesh;
4875 class MEDCouplingCartesianAMRPatchGen : public RefCountObject
4878 int getNumberOfCellsRecursiveWithOverlap() const throw(INTERP_KERNEL::Exception);
4879 int getNumberOfCellsRecursiveWithoutOverlap() const throw(INTERP_KERNEL::Exception);
4880 int getMaxNumberOfLevelsRelativeToThis() const throw(INTERP_KERNEL::Exception);
4883 MEDCouplingCartesianAMRMeshGen *getMesh() const throw(INTERP_KERNEL::Exception)
4885 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
4893 class MEDCouplingCartesianAMRPatch : public MEDCouplingCartesianAMRPatchGen
4896 int getNumberOfOverlapedCellsForFather() const throw(INTERP_KERNEL::Exception);
4897 bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const throw(INTERP_KERNEL::Exception);
4898 std::vector<int> computeCellGridSt() const throw(INTERP_KERNEL::Exception);
4901 PyObject *getBLTRRange() const throw(INTERP_KERNEL::Exception)
4903 const std::vector< std::pair<int,int> >& ret(self->getBLTRRange());
4904 return convertFromVectorPairInt(ret);
4907 PyObject *getBLTRRangeRelativeToGF() const throw(INTERP_KERNEL::Exception)
4909 std::vector< std::pair<int,int> > ret(self->getBLTRRangeRelativeToGF());
4910 return convertFromVectorPairInt(ret);
4913 void addPatch(PyObject *bottomLeftTopRight, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception)
4915 std::vector< std::pair<int,int> > inp;
4916 convertPyToVectorPairInt(bottomLeftTopRight,inp);
4917 self->addPatch(inp,factors);
4920 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const throw(INTERP_KERNEL::Exception)
4922 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
4924 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatchGen.__getitem__ : no underlying mesh !");
4925 if(patchId==mesh->getNumberOfPatches())
4927 std::ostringstream oss;
4928 oss << "Requesting for patchId " << patchId << " having only " << mesh->getNumberOfPatches() << " patches !";
4929 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4932 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(mesh->getPatch(patchId)));
4938 void __delitem__(int patchId) throw(INTERP_KERNEL::Exception)
4940 MEDCouplingCartesianAMRMeshGen *mesh(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
4942 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__delitem__ : no underlying mesh !");
4943 mesh->removePatch(patchId);
4946 int __len__() const throw(INTERP_KERNEL::Exception)
4948 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
4950 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__len__ : no underlying mesh !");
4951 return mesh->getNumberOfPatches();
4956 class MEDCouplingCartesianAMRPatchGF : public MEDCouplingCartesianAMRPatchGen
4960 class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel
4963 int getAbsoluteLevel() const throw(INTERP_KERNEL::Exception);
4964 int getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const throw(INTERP_KERNEL::Exception);
4965 std::vector<int> getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const throw(INTERP_KERNEL::Exception);
4966 int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
4967 const std::vector<int>& getFactors() const throw(INTERP_KERNEL::Exception);
4968 void setFactors(const std::vector<int>& newFactors) throw(INTERP_KERNEL::Exception);
4969 int getMaxNumberOfLevelsRelativeToThis() const throw(INTERP_KERNEL::Exception);
4970 int getNumberOfCellsAtCurrentLevel() const throw(INTERP_KERNEL::Exception);
4971 int getNumberOfCellsAtCurrentLevelGhost(int ghostLev) const throw(INTERP_KERNEL::Exception);
4972 int getNumberOfCellsRecursiveWithOverlap() const throw(INTERP_KERNEL::Exception);
4973 int getNumberOfCellsRecursiveWithoutOverlap() const throw(INTERP_KERNEL::Exception);
4974 bool isPatchInNeighborhoodOf(int patchId1, int patchId2, int ghostLev) const throw(INTERP_KERNEL::Exception);
4975 virtual void detachFromFather() throw(INTERP_KERNEL::Exception);
4977 int getNumberOfPatches() const throw(INTERP_KERNEL::Exception);
4978 int getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const throw(INTERP_KERNEL::Exception);
4979 MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
4980 DataArrayDouble *extractGhostFrom(int ghostSz, const DataArrayDouble *arr) const throw(INTERP_KERNEL::Exception);
4981 std::vector<int> getPatchIdsInTheNeighborhoodOf(int patchId, int ghostLev) const throw(INTERP_KERNEL::Exception);
4982 MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const throw(INTERP_KERNEL::Exception);
4983 MEDCoupling1SGTUMesh *buildMeshOfDirectChildrenOnly() const throw(INTERP_KERNEL::Exception);
4984 void removeAllPatches() throw(INTERP_KERNEL::Exception);
4985 void removePatch(int patchId) throw(INTERP_KERNEL::Exception);
4986 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception);
4987 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector<int>& factors, double eps) throw(INTERP_KERNEL::Exception);
4988 DataArrayDouble *createCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis) const throw(INTERP_KERNEL::Exception);
4989 void fillCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const throw(INTERP_KERNEL::Exception);
4990 void fillCellFieldOnPatchGhost(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev, bool isConservative=true) const throw(INTERP_KERNEL::Exception);
4991 void fillCellFieldOnPatchOnlyOnGhostZone(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev) const throw(INTERP_KERNEL::Exception);
4992 void fillCellFieldOnPatchOnlyOnGhostZoneWith(int ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const;
4993 void fillCellFieldComingFromPatch(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const throw(INTERP_KERNEL::Exception);
4994 void fillCellFieldComingFromPatchGhost(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, int ghostLev, bool isConservative=true) const throw(INTERP_KERNEL::Exception);
4995 DataArrayInt *findPatchesInTheNeighborhoodOf(int patchId, int ghostLev) const throw(INTERP_KERNEL::Exception);
4996 std::string buildPythonDumpOfThis() const throw(INTERP_KERNEL::Exception);
4999 void addPatch(PyObject *bottomLeftTopRight, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception)
5001 std::vector< std::pair<int,int> > inp;
5002 convertPyToVectorPairInt(bottomLeftTopRight,inp);
5003 self->addPatch(inp,factors);
5006 PyObject *getPatches() const throw(INTERP_KERNEL::Exception)
5008 std::vector< const MEDCouplingCartesianAMRPatch *> ps(self->getPatches());
5010 PyObject *ret = PyList_New(sz);
5011 for(int i=0;i<sz;i++)
5013 MEDCouplingCartesianAMRPatch *elt(const_cast<MEDCouplingCartesianAMRPatch *>(ps[i]));
5016 PyList_SetItem(ret,i,convertCartesianAMRPatch(elt, SWIG_POINTER_OWN | 0 ));
5021 // agy : don't know why typemap fails here ??? let it in the extend section
5022 PyObject *deepCpy(MEDCouplingCartesianAMRMeshGen *father) const throw(INTERP_KERNEL::Exception)
5024 return convertCartesianAMRMesh(self->deepCpy(father), SWIG_POINTER_OWN | 0 );
5027 MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector<int>& pos) const throw(INTERP_KERNEL::Exception)
5029 const MEDCouplingCartesianAMRPatch *ret(self->getPatchAtPosition(pos));
5030 MEDCouplingCartesianAMRPatch *ret2(const_cast<MEDCouplingCartesianAMRPatch *>(ret));
5036 MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector<int>& pos) const throw(INTERP_KERNEL::Exception)
5038 const MEDCouplingCartesianAMRMeshGen *ret(self->getMeshAtPosition(pos));
5039 MEDCouplingCartesianAMRMeshGen *ret2(const_cast<MEDCouplingCartesianAMRMeshGen *>(ret));
5045 virtual PyObject *positionRelativeToGodFather() const throw(INTERP_KERNEL::Exception)
5047 std::vector<int> out1;
5048 std::vector< std::pair<int,int> > out0(self->positionRelativeToGodFather(out1));
5049 PyObject *ret(PyTuple_New(2));
5050 PyTuple_SetItem(ret,0,convertFromVectorPairInt(out0));
5051 PyTuple_SetItem(ret,1,convertIntArrToPyList2(out1));
5055 virtual PyObject *retrieveGridsAt(int absoluteLev) const throw(INTERP_KERNEL::Exception)
5057 std::vector<MEDCouplingCartesianAMRPatchGen *> ps(self->retrieveGridsAt(absoluteLev));
5059 PyObject *ret = PyList_New(sz);
5060 for(int i=0;i<sz;i++)
5061 PyList_SetItem(ret,i,convertCartesianAMRPatch(ps[i], SWIG_POINTER_OWN | 0 ));
5065 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(int ghostSz, PyObject *recurseArrs) const
5067 std::vector<const DataArrayDouble *> inp;
5068 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayDouble *>(recurseArrs,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",inp);
5069 return self->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostSz,inp);
5072 virtual MEDCouplingCartesianAMRMeshGen *getFather() const throw(INTERP_KERNEL::Exception)
5074 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getFather()));
5080 virtual MEDCouplingCartesianAMRMeshGen *getGodFather() const throw(INTERP_KERNEL::Exception)
5082 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getGodFather()));
5088 MEDCouplingCartesianAMRPatch *getPatch(int patchId) const throw(INTERP_KERNEL::Exception)
5090 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5096 MEDCouplingIMesh *getImageMesh() const throw(INTERP_KERNEL::Exception)
5098 const MEDCouplingIMesh *ret(self->getImageMesh());
5101 return const_cast<MEDCouplingIMesh *>(ret);
5104 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const throw(INTERP_KERNEL::Exception)
5106 if(patchId==self->getNumberOfPatches())
5108 std::ostringstream oss;
5109 oss << "Requesting for patchId " << patchId << " having only " << self->getNumberOfPatches() << " patches !";
5110 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
5113 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
5119 void fillCellFieldOnPatchGhostAdv(int patchId, const DataArrayDouble *cellFieldOnThis, int ghostLev, PyObject *arrsOnPatches, bool isConservative=true) const throw(INTERP_KERNEL::Exception)
5121 std::vector<const ParaMEDMEM::DataArrayDouble *> arrsOnPatches2;
5122 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5123 self->fillCellFieldOnPatchGhostAdv(patchId,cellFieldOnThis,ghostLev,arrsOnPatches2,isConservative);
5126 void fillCellFieldOnPatchOnlyGhostAdv(int patchId, int ghostLev, PyObject *arrsOnPatches) const
5128 std::vector<const ParaMEDMEM::DataArrayDouble *> arrsOnPatches2;
5129 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
5130 self->fillCellFieldOnPatchOnlyGhostAdv(patchId,ghostLev,arrsOnPatches2);
5133 void __delitem__(int patchId) throw(INTERP_KERNEL::Exception)
5135 self->removePatch(patchId);
5138 int __len__() const throw(INTERP_KERNEL::Exception)
5140 return self->getNumberOfPatches();
5145 class MEDCouplingCartesianAMRMeshSub : public MEDCouplingCartesianAMRMeshGen
5149 class MEDCouplingCartesianAMRMesh : public MEDCouplingCartesianAMRMeshGen
5152 static MEDCouplingCartesianAMRMesh *New(MEDCouplingIMesh *mesh) throw(INTERP_KERNEL::Exception);
5155 static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
5157 static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !";
5158 static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !";
5159 const int *nodeStrctPtr(0);
5160 const double *originPtr(0),*dxyzPtr(0);
5162 std::vector<int> bb0;
5163 nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
5166 std::vector<double> bb,bb2;
5168 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
5169 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
5171 return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
5174 void createPatchesFromCriterionML(PyObject *bso, const DataArrayDouble *criterion, PyObject *factors, double eps) throw(INTERP_KERNEL::Exception)
5176 std::vector<const INTERP_KERNEL::BoxSplittingOptions *> inp0;
5177 convertFromPyObjVectorOfObj<const INTERP_KERNEL::BoxSplittingOptions *>(bso,SWIGTYPE_p_INTERP_KERNEL__BoxSplittingOptions,"BoxSplittingOptions",inp0);
5178 std::vector< std::vector<int> > inp2;
5179 convertPyToVectorOfVectorOfInt(factors,inp2);
5180 self->createPatchesFromCriterionML(inp0,criterion,inp2,eps);
5183 MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
5185 return ParaMEDMEM_MEDCouplingCartesianAMRMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
5188 MEDCouplingCartesianAMRMesh(MEDCouplingIMesh *mesh) throw(INTERP_KERNEL::Exception)
5190 return MEDCouplingCartesianAMRMesh::New(mesh);
5195 class MEDCouplingDataForGodFather : public RefCountObject
5198 virtual void synchronizeFineToCoarse() throw(INTERP_KERNEL::Exception);
5199 virtual void synchronizeFineToCoarseBetween(int fromLev, int toLev) throw(INTERP_KERNEL::Exception);
5200 virtual void synchronizeCoarseToFine() throw(INTERP_KERNEL::Exception);
5201 virtual void synchronizeCoarseToFineBetween(int fromLev, int toLev) throw(INTERP_KERNEL::Exception);
5202 virtual void synchronizeAllGhostZones() throw(INTERP_KERNEL::Exception);
5203 virtual void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh) throw(INTERP_KERNEL::Exception);
5204 virtual void synchronizeAllGhostZonesAtASpecifiedLevel(int level) throw(INTERP_KERNEL::Exception);
5205 virtual void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(int level) throw(INTERP_KERNEL::Exception);
5206 virtual void alloc() throw(INTERP_KERNEL::Exception);
5207 virtual void dealloc() throw(INTERP_KERNEL::Exception);
5210 MEDCouplingCartesianAMRMesh *getMyGodFather() throw(INTERP_KERNEL::Exception)
5212 MEDCouplingCartesianAMRMesh *ret(self->getMyGodFather());
5220 class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel
5223 int getNumberOfLevels() const throw(INTERP_KERNEL::Exception);
5224 MEDCouplingAMRAttribute *deepCpy() const throw(INTERP_KERNEL::Exception);
5225 MEDCouplingAMRAttribute *deepCpyWithoutGodFather() const throw(INTERP_KERNEL::Exception);
5226 MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception);
5227 MEDCouplingFieldDouble *buildCellFieldOnWithGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception);
5228 MEDCouplingFieldDouble *buildCellFieldOnWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception);
5229 bool changeGodFather(MEDCouplingCartesianAMRMesh *gf) throw(INTERP_KERNEL::Exception);
5230 MEDCouplingAMRAttribute *projectTo(MEDCouplingCartesianAMRMesh *targetGF) const throw(INTERP_KERNEL::Exception);
5231 std::string writeVTHB(const std::string& fileName) const throw(INTERP_KERNEL::Exception);
5234 static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, int ghostLev) throw(INTERP_KERNEL::Exception)
5236 std::vector< std::pair<std::string,int> > fieldNamesCpp0;
5237 std::vector< std::pair<std::string, std::vector<std::string> > > fieldNamesCpp1;
5238 MEDCouplingAMRAttribute *ret(0);
5241 convertPyToVectorPairStringInt(fieldNames,fieldNamesCpp0);
5242 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp0,ghostLev);
5244 catch(INTERP_KERNEL::Exception&)
5246 convertPyToVectorPairStringVecString(fieldNames,fieldNamesCpp1);
5247 ret=MEDCouplingAMRAttribute::New(gf,fieldNamesCpp1,ghostLev);
5252 MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, int ghostLev) throw(INTERP_KERNEL::Exception)
5254 return ParaMEDMEM_MEDCouplingAMRAttribute_New(gf,fieldNames,ghostLev);
5257 DataArrayDouble *getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception)
5259 const DataArrayDouble *ret(self->getFieldOn(mesh,fieldName));
5260 DataArrayDouble *ret2(const_cast<DataArrayDouble *>(ret));
5266 void spillInfoOnComponents(PyObject *compNames) throw(INTERP_KERNEL::Exception)
5268 std::vector< std::vector<std::string> > compNamesCpp;
5269 convertPyToVectorOfVectorOfString(compNames,compNamesCpp);
5270 self->spillInfoOnComponents(compNamesCpp);
5273 void spillNatures(PyObject *nfs) throw(INTERP_KERNEL::Exception)
5275 std::vector<int> inp0;
5276 if(!fillIntVector(nfs,inp0))
5277 throw INTERP_KERNEL::Exception("wrap of MEDCouplingAMRAttribute::spillNatures : vector of NatureOfField enum expected !");
5278 std::size_t sz(inp0.size());
5279 std::vector<NatureOfField> inp00(sz);
5280 for(std::size_t i=0;i<sz;i++)
5281 inp00[i]=(NatureOfField)inp0[i];
5282 self->spillNatures(inp00);
5285 PyObject *retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const throw(INTERP_KERNEL::Exception)
5287 std::vector<DataArrayDouble *> ret(self->retrieveFieldsOn(mesh));
5288 int sz((int)ret.size());
5289 PyObject *retPy(PyList_New(sz));
5290 for(int i=0;i<sz;i++)
5291 PyList_SetItem(retPy,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
5297 class DenseMatrix : public RefCountObject, public TimeLabel
5300 static DenseMatrix *New(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
5301 static DenseMatrix *New(DataArrayDouble *array, int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
5302 DenseMatrix *deepCpy() const throw(INTERP_KERNEL::Exception);
5303 DenseMatrix *shallowCpy() const throw(INTERP_KERNEL::Exception);
5305 int getNumberOfRows() const throw(INTERP_KERNEL::Exception);
5306 int getNumberOfCols() const throw(INTERP_KERNEL::Exception);
5307 int getNbOfElems() const throw(INTERP_KERNEL::Exception);
5308 void reBuild(DataArrayDouble *array, int nbRows=-1, int nbCols=-1) throw(INTERP_KERNEL::Exception);
5309 void reShape(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
5310 void transpose() throw(INTERP_KERNEL::Exception);
5312 bool isEqual(const DenseMatrix& other, double eps) const throw(INTERP_KERNEL::Exception);
5313 DataArrayDouble *matVecMult(const DataArrayDouble *vec) const throw(INTERP_KERNEL::Exception);
5314 static DataArrayDouble *MatVecMult(const DenseMatrix *mat, const DataArrayDouble *vec) throw(INTERP_KERNEL::Exception);
5317 DenseMatrix(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception)
5319 return DenseMatrix::New(nbRows,nbCols);
5322 DenseMatrix(DataArrayDouble *array, int nbRows, int nbCols) throw(INTERP_KERNEL::Exception)
5324 return DenseMatrix::New(array,nbRows,nbCols);
5327 PyObject *isEqualIfNotWhy(const DenseMatrix& other, double eps) const throw(INTERP_KERNEL::Exception)
5330 bool ret0=self->isEqualIfNotWhy(other,eps,ret1);
5331 PyObject *ret=PyTuple_New(2);
5332 PyObject *ret0Py=ret0?Py_True:Py_False;
5334 PyTuple_SetItem(ret,0,ret0Py);
5335 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5339 DataArrayDouble *getData() throw(INTERP_KERNEL::Exception)
5341 DataArrayDouble *ret(self->getData());
5347 DenseMatrix *__add__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5349 return ParaMEDMEM::DenseMatrix::Add(self,other);
5352 DenseMatrix *__sub__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5354 return ParaMEDMEM::DenseMatrix::Substract(self,other);
5357 DenseMatrix *__mul__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5359 return ParaMEDMEM::DenseMatrix::Multiply(self,other);
5362 DenseMatrix *__mul__(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception)
5364 return ParaMEDMEM::DenseMatrix::Multiply(self,other);
5367 PyObject *___iadd___(PyObject *trueSelf, const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5369 self->addEqual(other);
5370 Py_XINCREF(trueSelf);
5374 PyObject *___isub___(PyObject *trueSelf, const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5376 self->substractEqual(other);
5377 Py_XINCREF(trueSelf);
5381 PyObject *toNumPyMatrix() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5383 PyObject *obj(ToNumPyArrayUnderground<DataArrayDouble,double>(self->getData(),NPY_DOUBLE,"DataArrayDouble",self->getNumberOfRows(),self->getNumberOfCols()));
5393 __filename=os.environ.get('PYTHONSTARTUP')
5394 if __filename and os.path.isfile(__filename):
5395 execfile(__filename)