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 "MEDCouplingMatrix.hxx"
45 #include "MEDCouplingTypemaps.i"
47 #include "InterpKernelAutoPtr.hxx"
48 #include "BoxSplittingOptions.hxx"
50 using namespace ParaMEDMEM;
51 using namespace INTERP_KERNEL;
55 %template(ivec) std::vector<int>;
56 %template(dvec) std::vector<double>;
57 %template(svec) std::vector<std::string>;
60 %typemap(out) ParaMEDMEM::MEDCouplingMesh*
62 $result=convertMesh($1,$owner);
65 %typemap(out) MEDCouplingMesh*
67 $result=convertMesh($1,$owner);
72 %typemap(out) ParaMEDMEM::MEDCouplingPointSet*
74 $result=convertMesh($1,$owner);
77 %typemap(out) MEDCouplingPointSet*
79 $result=convertMesh($1,$owner);
84 %typemap(out) MEDCouplingCartesianAMRPatchGen*
86 $result=convertCartesianAMRPatch($1,$owner);
91 %typemap(out) MEDCouplingCartesianAMRMeshGen*
93 $result=convertCartesianAMRMesh($1,$owner);
98 %typemap(out) ParaMEDMEM::MEDCoupling1GTUMesh*
100 $result=convertMesh($1,$owner);
103 %typemap(out) MEDCoupling1GTUMesh*
105 $result=convertMesh($1,$owner);
110 %typemap(out) ParaMEDMEM::MEDCouplingStructuredMesh*
112 $result=convertMesh($1,$owner);
115 %typemap(out) MEDCouplingStructuredMesh*
117 $result=convertMesh($1,$owner);
122 %typemap(out) ParaMEDMEM::MEDCouplingFieldDiscretization*
124 $result=convertFieldDiscretization($1,$owner);
127 %typemap(out) MEDCouplingFieldDiscretization*
129 $result=convertFieldDiscretization($1,$owner);
134 %typemap(out) ParaMEDMEM::MEDCouplingMultiFields*
136 $result=convertMultiFields($1,$owner);
139 %typemap(out) MEDCouplingMultiFields*
141 $result=convertMultiFields($1,$owner);
146 %init %{ import_array(); %}
149 %feature("autodoc", "1");
150 %feature("docstring");
152 %newobject ParaMEDMEM::MEDCouplingField::buildMeasureField;
153 %newobject ParaMEDMEM::MEDCouplingField::getLocalizationOfDiscr;
154 %newobject ParaMEDMEM::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
155 %newobject ParaMEDMEM::MEDCouplingFieldDouble::New;
156 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getArray;
157 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getEndArray;
158 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MergeFields;
159 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MeldFields;
160 %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct;
161 %newobject ParaMEDMEM::MEDCouplingFieldDouble::determinant;
162 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenValues;
163 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenVectors;
164 %newobject ParaMEDMEM::MEDCouplingFieldDouble::inverse;
165 %newobject ParaMEDMEM::MEDCouplingFieldDouble::trace;
166 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deviator;
167 %newobject ParaMEDMEM::MEDCouplingFieldDouble::magnitude;
168 %newobject ParaMEDMEM::MEDCouplingFieldDouble::maxPerTuple;
169 %newobject ParaMEDMEM::MEDCouplingFieldDouble::keepSelectedComponents;
170 %newobject ParaMEDMEM::MEDCouplingFieldDouble::extractSlice3D;
171 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DotFields;
172 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dot;
173 %newobject ParaMEDMEM::MEDCouplingFieldDouble::CrossProductFields;
174 %newobject ParaMEDMEM::MEDCouplingFieldDouble::crossProduct;
175 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MaxFields;
176 %newobject ParaMEDMEM::MEDCouplingFieldDouble::max;
177 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MinFields;
178 %newobject ParaMEDMEM::MEDCouplingFieldDouble::AddFields;
179 %newobject ParaMEDMEM::MEDCouplingFieldDouble::SubstractFields;
180 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MultiplyFields;
181 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DivideFields;
182 %newobject ParaMEDMEM::MEDCouplingFieldDouble::min;
183 %newobject ParaMEDMEM::MEDCouplingFieldDouble::negate;
184 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getIdsInRange;
185 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart;
186 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPartRange;
187 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__getitem__;
188 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__neg__;
189 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__add__;
190 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__sub__;
191 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__mul__;
192 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__div__;
193 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__pow__;
194 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__radd__;
195 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rsub__;
196 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rmul__;
197 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rdiv__;
198 %newobject ParaMEDMEM::MEDCouplingFieldDouble::clone;
199 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cloneWithMesh;
200 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy;
201 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
202 %newobject ParaMEDMEM::MEDCouplingFieldDouble::nodeToCellDiscretization;
203 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cellToNodeDiscretization;
204 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
205 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
206 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
207 %newobject ParaMEDMEM::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
208 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
209 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfNodesPerCell;
210 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfFacesPerCell;
211 %newobject ParaMEDMEM::MEDCouplingMesh::computeEffectiveNbOfNodesPerCell;
212 %newobject ParaMEDMEM::MEDCouplingMesh::buildPartRange;
213 %newobject ParaMEDMEM::MEDCouplingMesh::giveCellsWithType;
214 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
215 %newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
216 %newobject ParaMEDMEM::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
217 %newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
218 %newobject ParaMEDMEM::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
219 %newobject ParaMEDMEM::MEDCouplingMesh::mergeMyselfWith;
220 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic;
221 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic2;
222 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic3;
223 %newobject ParaMEDMEM::MEDCouplingMesh::getMeasureField;
224 %newobject ParaMEDMEM::MEDCouplingMesh::simplexize;
225 %newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured;
226 %newobject ParaMEDMEM::MEDCouplingMesh::MergeMeshes;
227 %newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer;
228 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellsInBoundingBox;
229 %newobject ParaMEDMEM::MEDCouplingPointSet::findBoundaryNodes;
230 %newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh;
231 %newobject ParaMEDMEM::MEDCouplingPointSet::MergeNodesArray;
232 %newobject ParaMEDMEM::MEDCouplingPointSet::buildPartOfMySelf2;
233 %newobject ParaMEDMEM::MEDCouplingPointSet::BuildInstanceFromMeshType;
234 %newobject ParaMEDMEM::MEDCouplingPointSet::zipConnectivityTraducer;
235 %newobject ParaMEDMEM::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
236 %newobject ParaMEDMEM::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
237 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellIdsLyingOnNodes;
238 %newobject ParaMEDMEM::MEDCouplingPointSet::deepCpyConnectivityOnly;
239 %newobject ParaMEDMEM::MEDCouplingPointSet::getBoundingBoxForBBTree;
240 %newobject ParaMEDMEM::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells;
241 %newobject ParaMEDMEM::MEDCouplingPointSet::__getitem__;
242 %newobject ParaMEDMEM::MEDCouplingUMesh::New;
243 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
244 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
245 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
246 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
247 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
248 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
249 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
250 %newobject ParaMEDMEM::MEDCouplingUMesh::explode3DMeshTo1D;
251 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
252 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
253 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
254 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
255 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
256 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
257 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
258 %newobject ParaMEDMEM::MEDCouplingUMesh::conformize2D;
259 %newobject ParaMEDMEM::MEDCouplingUMesh::colinearize2D;
260 %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
261 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
262 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
263 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
264 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
265 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
266 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
267 %newobject ParaMEDMEM::MEDCouplingUMesh::convertLinearCellsToQuadratic;
268 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
269 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
270 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
271 %newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField;
272 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner;
273 %newobject ParaMEDMEM::MEDCouplingUMesh::computePlaneEquationOf3DFaces;
274 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField;
275 %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
276 %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
277 %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
278 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
279 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
280 %newobject ParaMEDMEM::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
281 %newobject ParaMEDMEM::MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh;
282 %newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
283 %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
284 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis;
285 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsCrossingPlane;
286 %newobject ParaMEDMEM::MEDCouplingUMesh::convexEnvelop2D;
287 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
288 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf2DMesh;
289 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf3DMesh;
290 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
291 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
292 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic;
293 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
294 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
295 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::New;
296 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::getNodalConnectivity;
297 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
298 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::New;
299 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
300 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::computeDualMesh;
301 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
302 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::sortHexa8EachOther;
303 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
304 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
305 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::New;
306 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
307 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
308 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
309 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
310 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
311 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
312 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::buildStructuredSubPart;
313 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTUnstructured;
314 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTSubLevelMesh;
315 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
316 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom;
317 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
318 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh;
319 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
320 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
321 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
322 %newobject ParaMEDMEM::MEDCouplingIMesh::New;
323 %newobject ParaMEDMEM::MEDCouplingIMesh::asSingleCell;
324 %newobject ParaMEDMEM::MEDCouplingIMesh::buildWithGhost;
325 %newobject ParaMEDMEM::MEDCouplingIMesh::convertToCartesian;
326 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
327 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
328 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
329 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
330 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
331 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
332 %newobject ParaMEDMEM::MEDCouplingCartesianAMRPatchGen::getMesh;
333 %newobject ParaMEDMEM::MEDCouplingCartesianAMRPatchGen::__getitem__;
334 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::buildUnstructured;
335 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::buildMeshFromPatchEnvelop;
336 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::buildMeshOfDirectChildrenOnly;
337 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getImageMesh;
338 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getGodFather;
339 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getFather;
340 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::getPatch;
341 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::createCellFieldOnPatch;
342 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::findPatchesInTheNeighborhoodOf;
343 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMeshGen::__getitem__;
344 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::New;
345 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getDataConst;
346 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getData;
347 %newobject ParaMEDMEM::DenseMatrix::New;
348 %newobject ParaMEDMEM::DenseMatrix::deepCpy;
349 %newobject ParaMEDMEM::DenseMatrix::shallowCpy;
350 %newobject ParaMEDMEM::DenseMatrix::getData;
351 %newobject ParaMEDMEM::DenseMatrix::matVecMult;
352 %newobject ParaMEDMEM::DenseMatrix::MatVecMult;
353 %newobject ParaMEDMEM::DenseMatrix::__add__;
354 %newobject ParaMEDMEM::DenseMatrix::__sub__;
355 %newobject ParaMEDMEM::DenseMatrix::__mul__;
357 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
358 %feature("unref") MEDCouplingMesh "$this->decrRef();"
359 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
360 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
361 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
362 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
363 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
364 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
365 %feature("unref") MEDCouplingIMesh "$this->decrRef();"
366 %feature("unref") MEDCouplingCurveLinearMesh "$this->decrRef();"
367 %feature("unref") MEDCouplingField "$this->decrRef();"
368 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
369 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
370 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
371 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
372 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
373 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
374 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
375 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
376 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
377 %feature("unref") MEDCouplingCartesianAMRMeshGen "$this->decrRef();"
378 %feature("unref") MEDCouplingCartesianAMRMesh "$this->decrRef();"
379 %feature("unref") MEDCouplingCartesianAMRMeshSub "$this->decrRef();"
380 %feature("unref") MEDCouplingCartesianAMRPatchGen "$this->decrRef();"
381 %feature("unref") MEDCouplingCartesianAMRPatchGF "$this->decrRef();"
382 %feature("unref") MEDCouplingCartesianAMRPatch "$this->decrRef();"
383 %feature("unref") MEDCouplingDataForGodFather "$this->decrRef();"
384 %feature("unref") DenseMatrix "$this->decrRef();"
386 %rename(assign) *::operator=;
387 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
388 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
389 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
390 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
394 %rename (InterpKernelException) INTERP_KERNEL::Exception;
396 %include "MEDCouplingRefCountObject.i"
397 %include "MEDCouplingMemArray.i"
399 namespace INTERP_KERNEL
402 * \class BoxSplittingOptions
403 * Class defining the options for box splitting used for AMR algorithm like creation of patches following a criterion.
405 class BoxSplittingOptions
408 BoxSplittingOptions();
409 void init() throw(INTERP_KERNEL::Exception);
410 double getEffeciency() const throw(INTERP_KERNEL::Exception);
411 void setEffeciency(double effeciency) throw(INTERP_KERNEL::Exception);
412 double getEffeciencySnd() const throw(INTERP_KERNEL::Exception);
413 void setEffeciencySnd(double effeciencySnd) throw(INTERP_KERNEL::Exception);
414 int getMinCellDirection() const throw(INTERP_KERNEL::Exception);
415 void setMinCellDirection(int minCellDirection) throw(INTERP_KERNEL::Exception);
416 int getMaxCells() const throw(INTERP_KERNEL::Exception);
417 void setMaxCells(int maxCells) throw(INTERP_KERNEL::Exception);
418 void copyOptions(const BoxSplittingOptions & other) throw(INTERP_KERNEL::Exception);
419 std::string printOptions() const throw(INTERP_KERNEL::Exception);
422 std::string __str__() const throw(INTERP_KERNEL::Exception)
424 return self->printOptions();
446 CONST_ON_TIME_INTERVAL = 7
447 } TypeOfTimeDiscretization;
455 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
456 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
458 } MEDCouplingMeshType;
461 class DataArrayDouble;
462 class MEDCouplingUMesh;
463 class MEDCouplingFieldDouble;
465 %extend RefCountObject
467 std::string getHiddenCppPointer() const
469 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
474 %extend MEDCouplingGaussLocalization
476 std::string __str__() const throw(INTERP_KERNEL::Exception)
478 return self->getStringRepr();
481 std::string __repr__() const throw(INTERP_KERNEL::Exception)
483 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
484 oss << self->getStringRepr();
491 class MEDCouplingMesh : public RefCountObject, public TimeLabel
494 void setName(const std::string& name);
495 std::string getName() const;
496 void setDescription(const std::string& descr);
497 std::string getDescription() const;
498 void setTime(double val, int iteration, int order);
499 void setTimeUnit(const std::string& unit);
500 std::string getTimeUnit() const;
501 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
502 bool isStructured() const throw(INTERP_KERNEL::Exception);
503 virtual MEDCouplingMesh *deepCpy() const;
504 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
505 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
506 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
507 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
508 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
509 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
510 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
511 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
512 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
513 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
514 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
515 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
516 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
517 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
518 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
519 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
520 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
521 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
522 virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
523 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
524 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
525 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
526 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
527 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
528 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
530 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
531 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
532 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
533 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
534 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception);
535 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
536 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
537 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
538 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
539 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
540 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
541 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
542 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
543 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
544 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
545 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
546 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
549 std::string __str__() const throw(INTERP_KERNEL::Exception)
551 return self->simpleRepr();
554 PyObject *getTime() throw(INTERP_KERNEL::Exception)
557 double tmp0=self->getTime(tmp1,tmp2);
558 PyObject *res = PyList_New(3);
559 PyList_SetItem(res,0,SWIG_From_double(tmp0));
560 PyList_SetItem(res,1,SWIG_From_int(tmp1));
561 PyList_SetItem(res,2,SWIG_From_int(tmp2));
565 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
569 DataArrayDoubleTuple *aa;
570 std::vector<double> bb;
572 int spaceDim=self->getSpaceDimension();
573 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
574 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
575 return self->getCellContainingPoint(pos,eps);
578 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
582 DataArrayDoubleTuple *aa;
583 std::vector<double> bb;
585 int spaceDim=self->getSpaceDimension();
586 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
587 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
588 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
589 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
590 PyObject *ret=PyTuple_New(2);
591 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
592 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
596 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
598 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
599 int spaceDim=self->getSpaceDimension();
601 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
602 if (!SWIG_IsOK(res1))
605 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
606 int nbOfPoints=size/spaceDim;
609 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
611 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
615 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
617 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
618 da2->checkAllocated();
619 int size=da2->getNumberOfTuples();
620 int nbOfCompo=da2->getNumberOfComponents();
621 if(nbOfCompo!=spaceDim)
623 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
625 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
627 PyObject *ret=PyTuple_New(2);
628 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
629 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
633 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
637 DataArrayDoubleTuple *aa;
638 std::vector<double> bb;
640 int spaceDim=self->getSpaceDimension();
641 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
642 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
643 std::vector<int> elts;
644 self->getCellsContainingPoint(pos,eps,elts);
645 DataArrayInt *ret=DataArrayInt::New();
646 ret->alloc((int)elts.size(),1);
647 std::copy(elts.begin(),elts.end(),ret->getPointer());
648 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
651 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
653 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
654 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
655 self->getReverseNodalConnectivity(d0,d1);
656 PyObject *ret=PyTuple_New(2);
657 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
658 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
662 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
665 int v0; std::vector<int> v1;
666 const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
667 self->renumberCells(ids,check);
670 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
672 DataArrayInt *cellCor, *nodeCor;
673 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
674 PyObject *res = PyList_New(2);
675 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
676 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
680 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
682 DataArrayInt *cellCor=0,*nodeCor=0;
683 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
684 PyObject *res = PyList_New(2);
685 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
686 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
690 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
692 DataArrayInt *cellCor=0;
693 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
697 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
700 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
701 if (!SWIG_IsOK(res1))
704 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
705 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
709 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
711 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
712 da2->checkAllocated();
713 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
716 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
718 std::vector<int> conn;
719 self->getNodeIdsOfCell(cellId,conn);
720 return convertIntArrToPyList2(conn);
723 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
725 std::vector<double> coo;
726 self->getCoordinatesOfNode(nodeId,coo);
727 return convertDblArrToPyList2(coo);
730 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
734 DataArrayDoubleTuple *aa;
735 std::vector<double> bb;
737 int spaceDim=self->getSpaceDimension();
738 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
739 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
740 self->scale(pointPtr,factor);
743 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
745 int spaceDim=self->getSpaceDimension();
746 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
747 self->getBoundingBox(tmp);
748 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
752 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
755 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
756 PyObject *ret=PyTuple_New(2);
757 PyObject *ret0Py=ret0?Py_True:Py_False;
759 PyTuple_SetItem(ret,0,ret0Py);
760 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
764 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
766 int szArr,sw,iTypppArr;
767 std::vector<int> stdvecTyyppArr;
768 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
769 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
770 if(sw==3)//DataArrayInt
772 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
773 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
774 std::string name=argpt->getName();
776 ret->setName(name.c_str());
778 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
781 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
783 int szArr,sw,iTypppArr;
784 std::vector<int> stdvecTyyppArr;
786 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
787 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
788 if(sw==3)//DataArrayInt
790 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
791 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
792 std::string name=argpt->getName();
794 ret->setName(name.c_str());
797 PyObject *res = PyList_New(2);
798 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
799 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
800 PyList_SetItem(res,0,obj0);
801 PyList_SetItem(res,1,obj1);
805 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
809 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
810 PyObject *res = PyTuple_New(2);
811 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
814 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
816 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
817 PyTuple_SetItem(res,0,obj0);
818 PyTuple_SetItem(res,1,obj1);
822 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
824 std::vector<int> vals=self->getDistributionOfTypes();
826 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
827 PyObject *ret=PyList_New((int)vals.size()/3);
828 for(int j=0;j<(int)vals.size()/3;j++)
830 PyObject *ret1=PyList_New(3);
831 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
832 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
833 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
834 PyList_SetItem(ret,j,ret1);
839 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
841 std::vector<int> code;
842 std::vector<const DataArrayInt *> idsPerType;
843 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
844 convertPyToNewIntArr4(li,1,3,code);
845 return self->checkTypeConsistencyAndContig(code,idsPerType);
848 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
850 std::vector<int> code;
851 std::vector<DataArrayInt *> idsInPflPerType;
852 std::vector<DataArrayInt *> idsPerType;
853 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
854 PyObject *ret=PyTuple_New(3);
857 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
858 PyObject *ret0=PyList_New((int)code.size()/3);
859 for(int j=0;j<(int)code.size()/3;j++)
861 PyObject *ret00=PyList_New(3);
862 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
863 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
864 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
865 PyList_SetItem(ret0,j,ret00);
867 PyTuple_SetItem(ret,0,ret0);
869 PyObject *ret1=PyList_New(idsInPflPerType.size());
870 for(std::size_t j=0;j<idsInPflPerType.size();j++)
871 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
872 PyTuple_SetItem(ret,1,ret1);
873 int n=idsPerType.size();
874 PyObject *ret2=PyList_New(n);
876 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
877 PyTuple_SetItem(ret,2,ret2);
881 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
885 DataArrayDoubleTuple *aa;
886 std::vector<double> bb;
888 int spaceDim=self->getSpaceDimension();
889 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
890 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
891 self->translate(vectorPtr);
894 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
896 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
899 DataArrayDoubleTuple *aa;
900 std::vector<double> bb;
902 int spaceDim=self->getSpaceDimension();
903 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
904 self->rotate(centerPtr,0,alpha);
907 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
909 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
911 DataArrayDouble *a,*a2;
912 DataArrayDoubleTuple *aa,*aa2;
913 std::vector<double> bb,bb2;
915 int spaceDim=self->getSpaceDimension();
916 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
917 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
918 self->rotate(centerPtr,vectorPtr,alpha);
921 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
923 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
924 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
925 PyObject *res=PyList_New(result.size());
926 for(int i=0;iL!=result.end(); i++, iL++)
927 PyList_SetItem(res,i,PyInt_FromLong(*iL));
931 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
933 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
934 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
935 return MEDCouplingMesh::MergeMeshes(tmp);
941 //== MEDCouplingMesh End
943 %include "NormalizedGeometricTypes"
944 %include "MEDCouplingNatureOfFieldEnum"
948 class MEDCouplingNatureOfField
951 static const char *GetRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception);
952 static std::string GetReprNoThrow(NatureOfField nat);
953 static std::string GetAllPossibilitiesStr();
957 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
958 // include "MEDCouplingTimeDiscretization.i"
962 class MEDCouplingGaussLocalization
965 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
966 const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
967 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
968 INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
969 void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
970 int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
971 int getDimension() const throw(INTERP_KERNEL::Exception);
972 int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
973 std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
974 void checkCoherency() const throw(INTERP_KERNEL::Exception);
975 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception);
977 const std::vector<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
978 double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
979 const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
980 double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
981 const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
982 double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
983 void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
984 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
985 void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
986 void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
987 void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
988 void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
990 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
994 %include "MEDCouplingFieldDiscretization.i"
996 //== MEDCouplingPointSet
1000 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
1003 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
1004 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
1005 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
1006 void zipCoords() throw(INTERP_KERNEL::Exception);
1007 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
1008 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
1009 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
1010 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
1011 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
1012 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
1013 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
1014 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
1015 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
1016 static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception);
1017 virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
1018 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
1019 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
1020 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
1021 virtual DataArrayInt *findBoundaryNodes() const;
1022 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
1023 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
1024 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
1025 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
1026 virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
1027 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1030 std::string __str__() const throw(INTERP_KERNEL::Exception)
1032 return self->simpleRepr();
1035 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
1038 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1039 PyObject *res = PyList_New(2);
1040 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1041 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
1045 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
1047 DataArrayInt *comm, *commIndex;
1048 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1049 PyObject *res = PyList_New(2);
1050 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1051 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1055 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
1057 DataArrayDouble *ret1=self->getCoords();
1060 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
1063 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
1065 int szArr,sw,iTypppArr;
1066 std::vector<int> stdvecTyyppArr;
1067 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1068 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1069 if(sw==3)//DataArrayInt
1071 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1072 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1073 std::string name=argpt->getName();
1075 ret->setName(name.c_str());
1077 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1080 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1082 int szArr,sw,iTypppArr;
1083 std::vector<int> stdvecTyyppArr;
1084 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1085 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1086 if(sw==3)//DataArrayInt
1088 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1089 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1090 std::string name=argpt->getName();
1092 ret->setName(name.c_str());
1094 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1097 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
1099 int szArr,sw,iTypppArr;
1100 std::vector<int> stdvecTyyppArr;
1101 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1102 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1103 if(sw==3)//DataArrayInt
1105 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1106 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1107 std::string name=argpt->getName();
1109 ret->setName(name.c_str());
1111 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1114 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1116 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1117 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1120 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1122 int szArr,sw,iTypppArr;
1123 std::vector<int> stdvecTyyppArr;
1124 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1125 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1126 if(sw==3)//DataArrayInt
1128 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1129 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1130 std::string name=argpt->getName();
1132 ret->setName(name.c_str());
1134 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1137 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1139 int szArr,sw,iTypppArr;
1140 std::vector<int> stdvecTyyppArr;
1141 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1142 self->renumberNodes(tmp,newNbOfNodes);
1145 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1147 int szArr,sw,iTypppArr;
1148 std::vector<int> stdvecTyyppArr;
1149 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1150 self->renumberNodes2(tmp,newNbOfNodes);
1153 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1155 int spaceDim=self->getSpaceDimension();
1157 DataArrayDouble *a,*a2;
1158 DataArrayDoubleTuple *aa,*aa2;
1159 std::vector<double> bb,bb2;
1161 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1162 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1163 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1164 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1165 std::vector<int> nodes;
1166 self->findNodesOnLine(p,v,eps,nodes);
1167 DataArrayInt *ret=DataArrayInt::New();
1168 ret->alloc((int)nodes.size(),1);
1169 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1170 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1172 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1174 int spaceDim=self->getSpaceDimension();
1176 DataArrayDouble *a,*a2;
1177 DataArrayDoubleTuple *aa,*aa2;
1178 std::vector<double> bb,bb2;
1180 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1181 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1182 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1183 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1184 std::vector<int> nodes;
1185 self->findNodesOnPlane(p,v,eps,nodes);
1186 DataArrayInt *ret=DataArrayInt::New();
1187 ret->alloc((int)nodes.size(),1);
1188 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1189 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1192 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1196 DataArrayDoubleTuple *aa;
1197 std::vector<double> bb;
1199 int spaceDim=self->getSpaceDimension();
1200 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1201 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1202 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1203 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1206 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1208 DataArrayInt *c=0,*cI=0;
1212 DataArrayDoubleTuple *aa;
1213 std::vector<double> bb;
1215 int spaceDim=self->getSpaceDimension();
1216 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1217 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1218 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1219 PyObject *ret=PyTuple_New(2);
1220 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1221 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1225 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1227 DataArrayInt *c=0,*cI=0;
1228 int spaceDim=self->getSpaceDimension();
1231 DataArrayDoubleTuple *aa;
1232 std::vector<double> bb;
1235 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1236 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1238 PyObject *ret=PyTuple_New(2);
1239 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1240 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1244 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1248 DataArrayDoubleTuple *aa;
1249 std::vector<double> bb;
1251 int spaceDim=self->getSpaceDimension();
1252 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1253 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1255 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1256 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1259 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1263 std::vector<int> multiVal;
1264 std::pair<int, std::pair<int,int> > slic;
1265 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1266 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1270 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1272 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1274 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1276 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1280 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1282 DataArrayInt *v0=0,*v1=0;
1283 self->findCommonCells(compType,startCellId,v0,v1);
1284 PyObject *res = PyList_New(2);
1285 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1286 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1291 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1294 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1295 if (!SWIG_IsOK(res1))
1298 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1299 self->renumberNodesInConn(tmp);
1303 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1305 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1306 da2->checkAllocated();
1307 self->renumberNodesInConn(da2->getConstPointer());
1311 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1314 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1315 PyObject *ret=PyTuple_New(2);
1316 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1317 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1321 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1323 DataArrayInt *ret=0;
1325 int szArr,sw,iTypppArr;
1326 std::vector<int> stdvecTyyppArr;
1327 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1328 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1332 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1336 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1337 PyObject *res = PyList_New(3);
1338 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1339 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1340 PyList_SetItem(res,2,SWIG_From_int(ret2));
1344 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1348 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1349 PyObject *res = PyList_New(3);
1350 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1351 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1352 PyList_SetItem(res,2,SWIG_From_int(ret2));
1356 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1359 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1360 if (!SWIG_IsOK(res1))
1363 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1364 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1368 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1370 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1371 da2->checkAllocated();
1372 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1376 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1380 std::vector<int> multiVal;
1381 std::pair<int, std::pair<int,int> > slic;
1382 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1383 int nbc=self->getNumberOfCells();
1384 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1391 std::ostringstream oss;
1392 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1393 throw INTERP_KERNEL::Exception(oss.str().c_str());
1396 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1401 int tmp=nbc+singleVal;
1402 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1406 std::ostringstream oss;
1407 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1408 throw INTERP_KERNEL::Exception(oss.str().c_str());
1414 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1418 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1423 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1424 daIntTyypp->checkAllocated();
1425 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1428 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1432 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1435 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1436 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1437 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1438 for(int i=0;i<sz;i++)
1439 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1442 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1445 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1447 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1448 std::vector<double> val3;
1449 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1450 "Rotate2DAlg",2,true,nbNodes);
1452 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1453 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1456 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1459 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1460 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1461 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1462 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1463 for(int i=0;i<sz;i++)
1464 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1467 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1470 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1472 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1473 std::vector<double> val3;
1474 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1475 "Rotate3DAlg",3,true,nbNodes);
1477 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1478 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1479 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1484 //== MEDCouplingPointSet End
1486 class MEDCouplingUMeshCell
1489 INTERP_KERNEL::NormalizedCellType getType() const;
1492 std::string __str__() const throw(INTERP_KERNEL::Exception)
1494 return self->repr();
1497 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1500 const int *r=self->getAllConn(ret2);
1501 PyObject *ret=PyTuple_New(ret2);
1502 for(int i=0;i<ret2;i++)
1503 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1509 class MEDCouplingUMeshCellIterator
1516 MEDCouplingUMeshCell *ret=self->nextt();
1518 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1521 PyErr_SetString(PyExc_StopIteration,"No more data.");
1528 class MEDCouplingUMeshCellByTypeIterator
1531 ~MEDCouplingUMeshCellByTypeIterator();
1536 MEDCouplingUMeshCellEntry *ret=self->nextt();
1538 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1541 PyErr_SetString(PyExc_StopIteration,"No more data.");
1548 class MEDCouplingUMeshCellByTypeEntry
1551 ~MEDCouplingUMeshCellByTypeEntry();
1554 MEDCouplingUMeshCellByTypeIterator *__iter__()
1556 return self->iterator();
1561 class MEDCouplingUMeshCellEntry
1564 INTERP_KERNEL::NormalizedCellType getType() const;
1565 int getNumberOfElems() const;
1568 MEDCouplingUMeshCellIterator *__iter__()
1570 return self->iterator();
1575 //== MEDCouplingUMesh
1577 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1580 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1581 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1582 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1583 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1584 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1585 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1586 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1587 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1588 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1589 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1590 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1591 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1592 void computeTypes() throw(INTERP_KERNEL::Exception);
1593 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1594 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1596 DataArrayInt *conformize2D(double eps) throw(INTERP_KERNEL::Exception);
1597 DataArrayInt *colinearize2D(double eps) throw(INTERP_KERNEL::Exception);
1598 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1599 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1600 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1601 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1602 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1603 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1604 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1605 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1606 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1607 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1608 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1609 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1610 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1611 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1612 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1613 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1614 bool isFullyQuadratic() const throw(INTERP_KERNEL::Exception);
1615 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1616 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1617 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1618 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1619 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1620 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1621 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1622 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1623 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1624 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1625 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1626 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1627 DataArrayDouble *computePlaneEquationOf3DFaces() const throw(INTERP_KERNEL::Exception);
1628 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1629 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1630 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1631 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1632 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1633 DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1634 DataArrayInt *buildUnionOf2DMesh() const throw(INTERP_KERNEL::Exception);
1635 DataArrayInt *buildUnionOf3DMesh() const throw(INTERP_KERNEL::Exception);
1636 DataArrayDouble *getBoundingBoxForBBTreeFast() const throw(INTERP_KERNEL::Exception);
1637 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1638 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1639 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);
1640 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1641 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1642 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1643 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1644 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1646 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1648 return MEDCouplingUMesh::New();
1651 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1653 return MEDCouplingUMesh::New(meshName,meshDim);
1656 std::string __str__() const throw(INTERP_KERNEL::Exception)
1658 return self->simpleRepr();
1661 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1663 std::ostringstream oss;
1664 self->reprQuickOverview(oss);
1668 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1670 return self->cellIterator();
1673 PyObject *getAllGeoTypesSorted() const throw(INTERP_KERNEL::Exception)
1675 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
1676 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1677 PyObject *res=PyList_New(result.size());
1678 for(int i=0;iL!=result.end(); i++, iL++)
1679 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1683 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1687 std::vector<int> multiVal;
1688 std::pair<int, std::pair<int,int> > slic;
1689 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1690 int nbc=self->getNumberOfCells();
1691 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1698 std::ostringstream oss;
1699 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1700 throw INTERP_KERNEL::Exception(oss.str().c_str());
1704 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1711 int tmp=nbc+singleVal;
1712 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1717 std::ostringstream oss;
1718 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1719 throw INTERP_KERNEL::Exception(oss.str().c_str());
1725 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1731 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1732 daIntTyypp->checkAllocated();
1733 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1737 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1741 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1745 std::vector<int> multiVal;
1746 std::pair<int, std::pair<int,int> > slic;
1747 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1748 int nbc=self->getNumberOfCells();
1749 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1756 std::ostringstream oss;
1757 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1758 throw INTERP_KERNEL::Exception(oss.str().c_str());
1762 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1769 int tmp=nbc+singleVal;
1770 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1775 std::ostringstream oss;
1776 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1777 throw INTERP_KERNEL::Exception(oss.str().c_str());
1783 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1788 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1794 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1795 daIntTyypp->checkAllocated();
1796 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1800 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1804 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1806 int szArr,sw,iTypppArr;
1807 std::vector<int> stdvecTyyppArr;
1808 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1811 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1812 throw INTERP_KERNEL::Exception(oss.str().c_str());
1814 self->insertNextCell(type,size,tmp);
1817 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1819 int szArr,sw,iTypppArr;
1820 std::vector<int> stdvecTyyppArr;
1821 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1822 self->insertNextCell(type,szArr,tmp);
1825 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1827 DataArrayInt *ret=self->getNodalConnectivity();
1832 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1834 DataArrayInt *ret=self->getNodalConnectivityIndex();
1840 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1842 int szArr,sw,iTypppArr;
1843 std::vector<int> stdvecTyyppArr;
1844 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1845 int nbOfDepthPeelingPerformed=0;
1846 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1847 PyObject *res=PyTuple_New(2);
1848 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1849 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1853 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1855 DataArrayInt *v0=0,*v1=0;
1856 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1857 PyObject *res = PyList_New(2);
1858 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1859 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1863 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1867 DataArrayDoubleTuple *aa;
1868 std::vector<double> bb;
1870 int nbOfCompo=self->getSpaceDimension();
1871 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1874 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1875 PyObject *ret=PyTuple_New(2);
1876 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1877 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1881 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1883 DataArrayInt *ret1=0;
1884 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1885 PyObject *ret=PyTuple_New(2);
1886 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1887 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1891 PyObject *tetrahedrize(int policy) throw(INTERP_KERNEL::Exception)
1894 DataArrayInt *ret1(0);
1895 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
1896 PyObject *ret=PyTuple_New(3);
1897 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
1898 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1899 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
1903 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1905 std::vector<int> cells;
1906 self->checkButterflyCells(cells,eps);
1907 DataArrayInt *ret=DataArrayInt::New();
1908 ret->alloc((int)cells.size(),1);
1909 std::copy(cells.begin(),cells.end(),ret->getPointer());
1910 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1913 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1915 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1917 PyObject *ret = PyList_New(sz);
1918 for(int i=0;i<sz;i++)
1919 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1923 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1925 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1926 int sz=retCpp.size();
1927 PyObject *ret=PyList_New(sz);
1928 for(int i=0;i<sz;i++)
1929 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1933 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1936 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1937 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1938 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1941 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1944 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1945 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1949 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1952 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1953 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1957 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1959 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1960 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1961 PyObject *ret=PyTuple_New(3);
1962 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1963 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1964 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1968 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1970 DataArrayInt *tmp0=0,*tmp1=0;
1971 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1972 PyObject *ret=PyTuple_New(2);
1973 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1974 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1978 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1982 std::vector<int> multiVal;
1983 std::pair<int, std::pair<int,int> > slic;
1984 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1985 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1989 return self->duplicateNodes(&singleVal,&singleVal+1);
1991 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
1993 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
1995 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1999 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
2003 std::vector<int> multiVal;
2004 std::pair<int, std::pair<int,int> > slic;
2005 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2006 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
2010 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
2012 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
2014 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
2016 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2020 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
2023 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
2024 DataArrayInt *tmp0,*tmp1=0;
2025 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2026 PyObject *ret=PyTuple_New(2);
2027 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2028 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2032 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const throw(INTERP_KERNEL::Exception)
2034 DataArrayInt *ret0=0,*ret1=0;
2035 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
2036 PyObject *ret=PyTuple_New(2);
2037 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2038 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2042 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2044 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2045 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2046 DataArrayInt *ret1=0,*ret2=0;
2047 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2048 PyObject *ret=PyTuple_New(3);
2049 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2050 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2051 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2055 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2057 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2058 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2059 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2060 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2063 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
2066 std::vector<const MEDCouplingUMesh *> meshes;
2067 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2068 std::vector<DataArrayInt *> corr;
2069 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2071 PyObject *ret1=PyList_New(sz);
2072 for(int i=0;i<sz;i++)
2073 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2074 PyObject *ret=PyList_New(2);
2075 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2076 PyList_SetItem(ret,1,ret1);
2080 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2082 std::vector<MEDCouplingUMesh *> meshes;
2083 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2084 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2087 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
2089 std::vector<MEDCouplingUMesh *> meshes;
2090 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2091 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2094 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
2098 std::vector<int> multiVal;
2099 std::pair<int, std::pair<int,int> > slic;
2100 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2102 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2103 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2107 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2109 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2111 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2113 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2117 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2119 DataArrayInt *arrOut=0,*arrIndexOut=0;
2122 std::vector<int> multiVal;
2123 std::pair<int, std::pair<int,int> > slic;
2124 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2126 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2127 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2132 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2137 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2142 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2146 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2148 PyObject *ret=PyTuple_New(2);
2149 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2150 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2154 static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2156 DataArrayInt *arrOut=0,*arrIndexOut=0;
2157 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2158 PyObject *ret=PyTuple_New(2);
2159 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2160 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2164 static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2166 if(!PySlice_Check(slic))
2167 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !");
2168 Py_ssize_t strt=2,stp=2,step=2;
2169 PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
2171 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !");
2172 arrIndxIn->checkAllocated();
2173 if(arrIndxIn->getNumberOfComponents()!=1)
2174 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !");
2175 GetIndicesOfSlice(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !");
2176 DataArrayInt *arrOut=0,*arrIndexOut=0;
2177 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2178 PyObject *ret=PyTuple_New(2);
2179 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2180 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2184 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2185 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2186 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2188 DataArrayInt *arrOut=0,*arrIndexOut=0;
2191 std::vector<int> multiVal;
2192 std::pair<int, std::pair<int,int> > slic;
2193 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2195 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2196 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2201 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2206 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2211 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2215 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2217 PyObject *ret=PyTuple_New(2);
2218 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2219 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2223 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2224 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2228 std::vector<int> multiVal;
2229 std::pair<int, std::pair<int,int> > slic;
2230 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2232 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2233 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2238 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2243 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2248 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2252 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2256 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2260 DataArrayDoubleTuple *aa;
2261 std::vector<double> bb;
2263 int spaceDim=self->getSpaceDimension();
2264 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2265 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2267 std::vector<int> cells;
2268 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2269 DataArrayInt *ret=DataArrayInt::New();
2270 ret->alloc((int)cells.size(),1);
2271 std::copy(cells.begin(),cells.end(),ret->getPointer());
2272 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2275 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2279 DataArrayDoubleTuple *aa;
2280 std::vector<double> bb;
2282 int spaceDim=self->getSpaceDimension();
2283 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2284 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2285 self->orientCorrectly2DCells(v,polyOnly);
2288 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2290 std::vector<int> cells;
2291 self->arePolyhedronsNotCorrectlyOriented(cells);
2292 DataArrayInt *ret=DataArrayInt::New();
2293 ret->alloc((int)cells.size(),1);
2294 std::copy(cells.begin(),cells.end(),ret->getPointer());
2295 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2298 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2302 self->getFastAveragePlaneOfThis(vec,pos);
2304 std::copy(vec,vec+3,vals);
2305 std::copy(pos,pos+3,vals+3);
2306 return convertDblArrToPyListOfTuple(vals,3,2);
2309 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2311 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2312 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2313 return MEDCouplingUMesh::MergeUMeshes(tmp);
2316 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2319 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2320 PyObject *ret=PyTuple_New(2);
2321 PyObject *ret0Py=ret0?Py_True:Py_False;
2323 PyTuple_SetItem(ret,0,ret0Py);
2324 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2328 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2331 bool ret0=self->areCellsIncludedIn2(other,ret1);
2332 PyObject *ret=PyTuple_New(2);
2333 PyObject *ret0Py=ret0?Py_True:Py_False;
2335 PyTuple_SetItem(ret,0,ret0Py);
2336 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2340 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2342 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2343 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2344 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2345 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2346 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2347 PyObject *ret=PyTuple_New(5);
2348 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2349 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2350 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2351 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2352 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2356 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2358 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2359 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2360 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2361 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2362 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2363 PyObject *ret=PyTuple_New(5);
2364 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2365 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2366 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2367 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2368 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2372 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2374 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2375 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2376 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2377 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2378 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2379 PyObject *ret=PyTuple_New(5);
2380 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2381 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2382 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2383 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2384 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2388 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2390 DataArrayInt *neighbors=0,*neighborsIdx=0;
2391 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2392 PyObject *ret=PyTuple_New(2);
2393 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2394 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2398 PyObject *computeNeighborsOfNodes() const throw(INTERP_KERNEL::Exception)
2400 DataArrayInt *neighbors=0,*neighborsIdx=0;
2401 self->computeNeighborsOfNodes(neighbors,neighborsIdx);
2402 PyObject *ret=PyTuple_New(2);
2403 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2404 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2408 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2410 DataArrayInt *neighbors=0,*neighborsIdx=0;
2411 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2412 PyObject *ret=PyTuple_New(2);
2413 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2414 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2418 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2420 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2421 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2422 DataArrayInt *d2,*d3,*d4,*dd5;
2423 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2424 PyObject *ret=PyTuple_New(7);
2425 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2426 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2427 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2428 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2429 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2430 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2431 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2435 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2438 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2439 da->checkAllocated();
2440 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2443 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2446 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2447 da->checkAllocated();
2448 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2451 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2454 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2455 da->checkAllocated();
2456 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2459 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2462 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2463 da->checkAllocated();
2464 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2465 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2466 PyObject *res = PyList_New(result.size());
2467 for (int i=0;iL!=result.end(); i++, iL++)
2468 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2472 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2475 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2476 da->checkAllocated();
2477 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2478 ret->setName(da->getName().c_str());
2482 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2484 DataArrayInt *cellNb1=0,*cellNb2=0;
2485 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2486 PyObject *ret=PyTuple_New(3);
2487 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2488 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2489 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2493 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2495 int spaceDim=self->getSpaceDimension();
2497 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2499 DataArrayDouble *a,*a2;
2500 DataArrayDoubleTuple *aa,*aa2;
2501 std::vector<double> bb,bb2;
2503 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2504 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2505 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2506 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2508 DataArrayInt *cellIds=0;
2509 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2510 PyObject *ret=PyTuple_New(2);
2511 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2512 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2516 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2518 int spaceDim=self->getSpaceDimension();
2520 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2522 DataArrayDouble *a,*a2;
2523 DataArrayDoubleTuple *aa,*aa2;
2524 std::vector<double> bb,bb2;
2526 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2527 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2528 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2529 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2531 DataArrayInt *cellIds=0;
2532 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2533 PyObject *ret=PyTuple_New(2);
2534 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2535 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2539 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2541 int spaceDim=self->getSpaceDimension();
2543 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2545 DataArrayDouble *a,*a2;
2546 DataArrayDoubleTuple *aa,*aa2;
2547 std::vector<double> bb,bb2;
2549 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2550 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2551 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2552 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2553 return self->getCellIdsCrossingPlane(orig,vect,eps);
2556 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2560 std::vector<int> pos2;
2561 DataArrayInt *pos3=0;
2562 DataArrayIntTuple *pos4=0;
2563 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2568 self->convertToPolyTypes(&pos1,&pos1+1);
2575 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2580 self->convertToPolyTypes(pos3->begin(),pos3->end());
2584 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2588 void convertAllToPoly();
2589 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2590 bool unPolyze() throw(INTERP_KERNEL::Exception);
2591 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2592 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2593 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2596 //== MEDCouplingUMesh End
2598 //== MEDCouplingExtrudedMesh
2600 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2603 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2604 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2606 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2608 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2611 std::string __str__() const throw(INTERP_KERNEL::Exception)
2613 return self->simpleRepr();
2616 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2618 std::ostringstream oss;
2619 self->reprQuickOverview(oss);
2623 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2625 MEDCouplingUMesh *ret=self->getMesh2D();
2628 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2630 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2632 MEDCouplingUMesh *ret=self->getMesh1D();
2635 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2637 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2639 DataArrayInt *ret=self->getMesh3DIds();
2642 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2647 //== MEDCouplingExtrudedMesh End
2649 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2652 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2653 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2654 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2655 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2656 virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2657 virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
2660 virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2662 int szArr,sw,iTypppArr;
2663 std::vector<int> stdvecTyyppArr;
2664 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2665 self->insertNextCell(tmp,tmp+szArr);
2668 virtual DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2670 DataArrayInt *ret=self->getNodalConnectivity();
2671 if(ret) ret->incrRef();
2675 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2677 std::vector< const MEDCoupling1GTUMesh *> parts;
2678 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
2679 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
2684 //== MEDCoupling1SGTUMesh
2686 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2689 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2690 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2691 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2692 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2693 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2694 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2695 MEDCoupling1GTUMesh *computeDualMesh() const throw(INTERP_KERNEL::Exception);
2696 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const throw(INTERP_KERNEL::Exception);
2697 DataArrayInt *sortHexa8EachOther() throw(INTERP_KERNEL::Exception);
2700 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2702 return MEDCoupling1SGTUMesh::New(name,type);
2705 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2707 return MEDCoupling1SGTUMesh::New(m);
2710 std::string __str__() const throw(INTERP_KERNEL::Exception)
2712 return self->simpleRepr();
2715 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2717 std::ostringstream oss;
2718 self->reprQuickOverview(oss);
2722 PyObject *structurizeMe(double eps=1e-12) const throw(INTERP_KERNEL::Exception)
2724 DataArrayInt *cellPerm(0),*nodePerm(0);
2725 MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps));
2726 PyObject *ret(PyTuple_New(3));
2727 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 ));
2728 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2729 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2733 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2735 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2736 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2737 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2740 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2742 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2743 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2744 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2749 //== MEDCoupling1SGTUMesh End
2751 //== MEDCoupling1DGTUMesh
2753 class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2756 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2757 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2758 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
2759 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2760 bool isPacked() const throw(INTERP_KERNEL::Exception);
2763 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2765 return MEDCoupling1DGTUMesh::New(name,type);
2768 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2770 return MEDCoupling1DGTUMesh::New(m);
2773 std::string __str__() const throw(INTERP_KERNEL::Exception)
2775 return self->simpleRepr();
2778 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2780 std::ostringstream oss;
2781 self->reprQuickOverview(oss);
2785 DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
2787 DataArrayInt *ret=self->getNodalConnectivityIndex();
2788 if(ret) ret->incrRef();
2792 PyObject *retrievePackedNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2794 DataArrayInt *ret1=0,*ret2=0;
2795 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
2796 PyObject *ret0Py=ret0?Py_True:Py_False;
2798 PyObject *ret=PyTuple_New(3);
2799 PyTuple_SetItem(ret,0,ret0Py);
2800 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2801 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2805 PyObject *copyWithNodalConnectivityPacked() const throw(INTERP_KERNEL::Exception)
2808 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
2809 PyObject *ret=PyTuple_New(2);
2810 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
2811 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
2812 PyTuple_SetItem(ret,1,ret1Py);
2816 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2818 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2819 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2820 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
2823 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2825 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2826 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2827 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
2830 static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt) throw(INTERP_KERNEL::Exception)
2832 std::vector<const ParaMEDMEM::DataArrayInt *> tmp;
2833 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2834 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
2839 //== MEDCoupling1DGTUMeshEnd
2841 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2844 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2845 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2846 int getNumberOfCellsOfSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2847 int getSpaceDimensionOnNodeStruct() const throw(INTERP_KERNEL::Exception);
2848 virtual std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2849 std::vector<int> getCellGridStructure() const throw(INTERP_KERNEL::Exception);
2850 MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception);
2851 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
2852 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2853 static int DeduceNumberOfGivenStructure(const std::vector<int>& st) throw(INTERP_KERNEL::Exception);
2854 static std::vector<int> GetSplitVectFromStruct(const std::vector<int>& strct) throw(INTERP_KERNEL::Exception);
2857 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const throw(INTERP_KERNEL::Exception)
2859 int tmpp1=-1,tmpp2=-1;
2860 std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
2861 std::vector< std::pair<int,int> > inp;
2865 for(int i=0;i<tmpp1;i++)
2866 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2871 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
2872 inp.resize(tmpp1/2);
2873 for(int i=0;i<tmpp1/2;i++)
2874 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2877 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
2878 return self->buildStructuredSubPart(inp);
2881 static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) throw(INTERP_KERNEL::Exception)
2883 std::vector< std::pair<int,int> > inp;
2884 convertPyToVectorPairInt(part,inp);
2886 int szArr,sw,iTypppArr;
2887 std::vector<int> stdvecTyyppArr;
2888 const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
2889 std::vector<int> tmp5(tmp4,tmp4+szArr);
2891 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
2894 static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector<int>& st, const DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat) throw(INTERP_KERNEL::Exception)
2896 std::vector< std::pair<int,int> > inp;
2897 convertPyToVectorPairInt(partCompactFormat,inp);
2898 return MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,fieldOfDbl,inp);
2901 static int DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part) throw(INTERP_KERNEL::Exception)
2903 std::vector< std::pair<int,int> > inp;
2904 convertPyToVectorPairInt(part,inp);
2905 return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp);
2908 static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) throw(INTERP_KERNEL::Exception)
2910 int szArr,sw,iTypppArr;
2911 std::vector<int> stdvecTyyppArr;
2912 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2913 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
2916 static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2918 int szArr,sw,iTypppArr;
2919 std::vector<int> stdvecTyyppArr;
2920 const int *tmp(convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr));
2921 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
2924 static std::vector<int> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat) throw(INTERP_KERNEL::Exception)
2926 std::vector< std::pair<int,int> > inp;
2927 convertPyToVectorPairInt(partCompactFormat,inp);
2928 return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp);
2931 static PyObject *GetCompactFrmtFromDimensions(const std::vector<int>& dims) throw(INTERP_KERNEL::Exception)
2933 std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dims));
2934 PyObject *retPy=PyList_New(ret.size());
2935 for(std::size_t i=0;i<ret.size();i++)
2937 PyObject *tmp=PyTuple_New(2);
2938 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
2939 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
2940 PyList_SetItem(retPy,i,tmp);
2945 static PyObject *IntersectRanges(PyObject *r1, PyObject *r2) throw(INTERP_KERNEL::Exception)
2947 std::vector< std::pair<int,int> > r1Cpp,r2Cpp;
2948 convertPyToVectorPairInt(r1,r1Cpp);
2949 convertPyToVectorPairInt(r2,r2Cpp);
2950 std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::IntersectRanges(r1Cpp,r2Cpp));
2951 PyObject *retPy=PyList_New(ret.size());
2952 for(std::size_t i=0;i<ret.size();i++)
2954 PyObject *tmp=PyTuple_New(2);
2955 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
2956 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
2957 PyList_SetItem(retPy,i,tmp);
2962 static PyObject *IsPartStructured(PyObject *li, PyObject *st) throw(INTERP_KERNEL::Exception)
2964 int szArr,sw,iTypppArr;
2965 std::vector<int> stdvecTyyppArr;
2966 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2967 int szArr2,sw2,iTypppArr2;
2968 std::vector<int> stdvecTyyppArr2;
2969 const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
2970 std::vector<int> tmp3(tmp2,tmp2+szArr2);
2971 std::vector< std::pair<int,int> > partCompactFormat;
2972 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
2973 PyObject *ret=PyTuple_New(2);
2974 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
2975 PyTuple_SetItem(ret,0,ret0Py);
2976 PyObject *ret1Py=PyList_New(partCompactFormat.size());
2977 for(std::size_t i=0;i<partCompactFormat.size();i++)
2979 PyObject *tmp4=PyTuple_New(2);
2980 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
2981 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
2982 PyList_SetItem(ret1Py,i,tmp4);
2984 PyTuple_SetItem(ret,1,ret1Py);
2988 static PyObject *ChangeReferenceFromGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigInAbs, bool check=true) throw(INTERP_KERNEL::Exception)
2990 std::vector< std::pair<int,int> > param0,param1,ret;
2991 convertPyToVectorPairInt(bigInAbs,param0);
2992 convertPyToVectorPairInt(partOfBigInAbs,param1);
2993 MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(param0,param1,ret,check);
2994 PyObject *retPy(PyList_New(ret.size()));
2995 for(std::size_t i=0;i<ret.size();i++)
2997 PyObject *tmp(PyTuple_New(2));
2998 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
2999 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3000 PyList_SetItem(retPy,i,tmp);
3005 static PyObject *ChangeReferenceToGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigRelativeToBig, bool check=true) throw(INTERP_KERNEL::Exception)
3007 std::vector< std::pair<int,int> > param0,param1,ret;
3008 convertPyToVectorPairInt(bigInAbs,param0);
3009 convertPyToVectorPairInt(partOfBigRelativeToBig,param1);
3010 MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(param0,param1,ret,check);
3011 PyObject *retPy(PyList_New(ret.size()));
3012 for(std::size_t i=0;i<ret.size();i++)
3014 PyObject *tmp(PyTuple_New(2));
3015 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
3016 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
3017 PyList_SetItem(retPy,i,tmp);
3024 //== MEDCouplingCMesh
3026 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3029 static MEDCouplingCMesh *New() throw(INTERP_KERNEL::Exception);
3030 static MEDCouplingCMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
3031 MEDCouplingCMesh *clone(bool recDeepCpy) const;
3032 void setCoords(const DataArrayDouble *coordsX,
3033 const DataArrayDouble *coordsY=0,
3034 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
3035 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
3037 MEDCouplingCMesh() throw(INTERP_KERNEL::Exception)
3039 return MEDCouplingCMesh::New();
3041 MEDCouplingCMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
3043 return MEDCouplingCMesh::New(meshName);
3045 std::string __str__() const throw(INTERP_KERNEL::Exception)
3047 return self->simpleRepr();
3049 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3051 std::ostringstream oss;
3052 self->reprQuickOverview(oss);
3055 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
3057 DataArrayDouble *ret=self->getCoordsAt(i);
3065 //== MEDCouplingCMesh End
3067 //== MEDCouplingCurveLinearMesh
3069 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3072 static MEDCouplingCurveLinearMesh *New() throw(INTERP_KERNEL::Exception);
3073 static MEDCouplingCurveLinearMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
3074 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
3075 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
3077 MEDCouplingCurveLinearMesh() throw(INTERP_KERNEL::Exception)
3079 return MEDCouplingCurveLinearMesh::New();
3081 MEDCouplingCurveLinearMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
3083 return MEDCouplingCurveLinearMesh::New(meshName);
3085 std::string __str__() const throw(INTERP_KERNEL::Exception)
3087 return self->simpleRepr();
3089 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3091 std::ostringstream oss;
3092 self->reprQuickOverview(oss);
3095 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
3097 DataArrayDouble *ret=self->getCoords();
3102 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
3104 int szArr,sw,iTypppArr;
3105 std::vector<int> stdvecTyyppArr;
3106 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
3107 self->setNodeGridStructure(tmp,tmp+szArr);
3112 //== MEDCouplingCurveLinearMesh End
3114 //== MEDCouplingIMesh
3116 class MEDCouplingIMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3119 static MEDCouplingIMesh *New() throw(INTERP_KERNEL::Exception);
3121 void setSpaceDimension(int spaceDim) throw(INTERP_KERNEL::Exception);
3122 std::vector<int> getNodeStruct() const throw(INTERP_KERNEL::Exception);
3123 std::vector<double> getOrigin() const throw(INTERP_KERNEL::Exception);
3124 std::vector<double> getDXYZ() const throw(INTERP_KERNEL::Exception);
3125 void setAxisUnit(const std::string& unitName) throw(INTERP_KERNEL::Exception);
3126 std::string getAxisUnit() const throw(INTERP_KERNEL::Exception);
3127 double getMeasureOfAnyCell() const throw(INTERP_KERNEL::Exception);
3128 MEDCouplingCMesh *convertToCartesian() const throw(INTERP_KERNEL::Exception);
3129 void refineWithFactor(const std::vector<int>& factors) throw(INTERP_KERNEL::Exception);
3130 MEDCouplingIMesh *asSingleCell() const throw(INTERP_KERNEL::Exception);
3131 MEDCouplingIMesh *buildWithGhost(int ghostLev) const throw(INTERP_KERNEL::Exception);
3136 return MEDCouplingIMesh::New();
3138 static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3140 static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
3141 static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
3142 const int *nodeStrctPtr(0);
3143 const double *originPtr(0),*dxyzPtr(0);
3145 std::vector<int> bb0;
3146 nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
3149 std::vector<double> bb,bb2;
3151 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
3152 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
3154 return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
3157 MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3159 return ParaMEDMEM_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
3162 void setNodeStruct(PyObject *nodeStrct) throw(INTERP_KERNEL::Exception)
3165 std::vector<int> bb0;
3166 const int *nodeStrctPtr(convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0));
3167 self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
3170 void setOrigin(PyObject *origin) throw(INTERP_KERNEL::Exception)
3172 static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3175 DataArrayDoubleTuple *aa;
3176 std::vector<double> bb;
3178 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
3179 self->setOrigin(originPtr,originPtr+nbTuples);
3182 void setDXYZ(PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3184 static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3187 DataArrayDoubleTuple *aa;
3188 std::vector<double> bb;
3190 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
3191 self->setDXYZ(originPtr,originPtr+nbTuples);
3194 static void CondenseFineToCoarse(const std::vector<int>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, DataArrayDouble *coarseDA) throw(INTERP_KERNEL::Exception)
3196 std::vector< std::pair<int,int> > inp;
3197 convertPyToVectorPairInt(fineLocInCoarse,inp);
3198 MEDCouplingIMesh::CondenseFineToCoarse(coarseSt,fineDA,inp,facts,coarseDA);
3201 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)
3203 std::vector< std::pair<int,int> > inp;
3204 convertPyToVectorPairInt(fineLocInCoarse,inp);
3205 MEDCouplingIMesh::CondenseFineToCoarseGhost(coarseSt,fineDA,inp,facts,coarseDA,ghostSize);
3208 static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts) throw(INTERP_KERNEL::Exception)
3210 std::vector< std::pair<int,int> > inp;
3211 convertPyToVectorPairInt(fineLocInCoarse,inp);
3212 MEDCouplingIMesh::SpreadCoarseToFine(coarseDA,coarseSt,fineDA,inp,facts);
3215 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)
3217 std::vector< std::pair<int,int> > inp;
3218 convertPyToVectorPairInt(fineLocInCoarse,inp);
3219 MEDCouplingIMesh::SpreadCoarseToFineGhost(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3222 std::string __str__() const throw(INTERP_KERNEL::Exception)
3224 return self->simpleRepr();
3226 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3228 std::ostringstream oss;
3229 self->reprQuickOverview(oss);
3235 //== MEDCouplingIMesh End
3239 namespace ParaMEDMEM
3241 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
3244 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
3245 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
3246 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3247 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3248 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
3249 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
3250 void setName(const char *name) throw(INTERP_KERNEL::Exception);
3251 std::string getDescription() const throw(INTERP_KERNEL::Exception);
3252 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
3253 std::string getName() const throw(INTERP_KERNEL::Exception);
3254 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
3255 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
3256 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
3257 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
3258 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
3259 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
3260 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
3261 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3262 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
3263 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
3264 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
3265 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
3266 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
3267 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
3268 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
3269 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3271 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
3273 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3276 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3279 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
3281 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3284 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3287 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
3289 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
3290 return convertIntArrToPyList3(ret);
3293 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
3296 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
3297 PyObject *ret=PyTuple_New(2);
3298 PyObject *ret0Py=ret0?Py_True:Py_False;
3300 PyTuple_SetItem(ret,0,ret0Py);
3301 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3305 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
3307 DataArrayInt *ret1=0;
3308 MEDCouplingMesh *ret0=0;
3310 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3311 if (!SWIG_IsOK(res1))
3314 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3315 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3319 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3321 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3322 da2->checkAllocated();
3323 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3325 PyObject *res = PyList_New(2);
3326 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3327 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3331 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
3333 DataArrayInt *ret1=0;
3335 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3336 PyObject *res=PyTuple_New(2);
3337 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3339 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3342 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3343 PyTuple_SetItem(res,1,res1);
3348 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3351 int v0; std::vector<int> v1;
3352 const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
3353 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3356 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3357 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3360 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3361 if (!SWIG_IsOK(res1))
3364 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3365 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3369 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3371 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3372 da2->checkAllocated();
3373 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3377 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3379 std::vector<int> tmp;
3380 self->getCellIdsHavingGaussLocalization(locId,tmp);
3381 DataArrayInt *ret=DataArrayInt::New();
3382 ret->alloc((int)tmp.size(),1);
3383 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3384 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3387 int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
3389 std::vector<int> inp0;
3390 convertPyToNewIntArr4(code,1,3,inp0);
3391 std::vector<const DataArrayInt *> inp1;
3392 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(idsPerType,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",inp1);
3393 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3398 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3401 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3402 static MEDCouplingFieldTemplate *New(TypeOfField type);
3403 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3404 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3407 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3409 return MEDCouplingFieldTemplate::New(f);
3412 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3414 return MEDCouplingFieldTemplate::New(type);
3417 std::string __str__() const throw(INTERP_KERNEL::Exception)
3419 return self->simpleRepr();
3422 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3424 std::ostringstream oss;
3425 self->reprQuickOverview(oss);
3431 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3434 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3435 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3436 void setTimeUnit(const std::string& unit);
3437 std::string getTimeUnit() const;
3438 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3439 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3440 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3441 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3442 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3443 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
3444 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3445 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3446 MEDCouplingFieldDouble *deepCpy() const;
3447 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3448 MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
3449 MEDCouplingFieldDouble *cellToNodeDiscretization() const throw(INTERP_KERNEL::Exception);
3450 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3451 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3452 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3453 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3454 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3455 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3456 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3457 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3458 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3459 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3460 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
3461 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3462 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3463 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3464 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3465 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3466 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3467 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3468 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3469 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3470 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3471 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3472 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3473 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3474 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3475 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3476 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3477 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3478 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3479 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3480 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3481 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3482 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3483 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3484 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3485 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3486 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3487 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3488 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3489 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3490 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3491 void fillFromAnalytic(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3492 void fillFromAnalytic2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3493 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3494 void applyFunc(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3495 void applyFunc2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3496 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3497 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3498 void applyFunc(const std::string& func) throw(INTERP_KERNEL::Exception);
3499 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
3500 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
3501 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3502 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3503 double getMinValue() const throw(INTERP_KERNEL::Exception);
3504 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3505 double norm2() const throw(INTERP_KERNEL::Exception);
3506 double normMax() const throw(INTERP_KERNEL::Exception);
3507 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3508 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3509 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3510 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3511 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3512 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3513 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3514 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3515 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3516 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3517 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3518 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3519 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3520 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3521 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3522 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3523 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3524 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3525 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3526 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3527 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3528 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3530 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3532 return MEDCouplingFieldDouble::New(type,td);
3535 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3537 return MEDCouplingFieldDouble::New(ft,td);
3540 std::string __str__() const throw(INTERP_KERNEL::Exception)
3542 return self->simpleRepr();
3545 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3547 std::ostringstream oss;
3548 self->reprQuickOverview(oss);
3552 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3554 DataArrayDouble *ret=self->getArray();
3560 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3562 std::vector<DataArrayDouble *> arrs=self->getArrays();
3563 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3567 PyObject *ret=PyTuple_New(sz);
3568 for(int i=0;i<sz;i++)
3571 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3573 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3578 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3580 std::vector<const DataArrayDouble *> tmp;
3581 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3583 std::vector<DataArrayDouble *> arrs(sz);
3584 for(int i=0;i<sz;i++)
3585 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3586 self->setArrays(arrs);
3589 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3591 DataArrayDouble *ret=self->getEndArray();
3597 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3601 DataArrayDoubleTuple *aa;
3602 std::vector<double> bb;
3604 const MEDCouplingMesh *mesh=self->getMesh();
3606 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3607 int spaceDim=mesh->getSpaceDimension();
3608 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3609 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3611 int sz=self->getNumberOfComponents();
3612 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3613 self->getValueOn(spaceLoc,res);
3614 return convertDblArrToPyList(res,sz);
3617 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3619 int sz=self->getNumberOfComponents();
3620 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3621 self->getValueOnPos(i,j,k,res);
3622 return convertDblArrToPyList(res,sz);
3625 DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
3627 const MEDCouplingMesh *mesh(self->getMesh());
3629 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3632 double v0; ParaMEDMEM::DataArrayDouble *v1(0); ParaMEDMEM::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
3633 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
3634 mesh->getSpaceDimension(),true,nbPts);
3635 return self->getValueOnMulti(inp,nbPts);
3638 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3642 DataArrayDoubleTuple *aa;
3643 std::vector<double> bb;
3645 const MEDCouplingMesh *mesh=self->getMesh();
3647 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3648 int spaceDim=mesh->getSpaceDimension();
3649 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3650 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3653 int sz=self->getNumberOfComponents();
3654 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3655 self->getValueOn(spaceLoc,time,res);
3656 return convertDblArrToPyList(res,sz);
3659 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3661 if(self->getArray()!=0)
3662 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3665 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3666 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3667 self->setArray(arr);
3671 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3674 double tmp0=self->getTime(tmp1,tmp2);
3675 PyObject *res = PyList_New(3);
3676 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3677 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3678 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3682 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3685 double tmp0=self->getStartTime(tmp1,tmp2);
3686 PyObject *res = PyList_New(3);
3687 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3688 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3689 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3693 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3696 double tmp0=self->getEndTime(tmp1,tmp2);
3697 PyObject *res = PyList_New(3);
3698 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3699 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3700 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3703 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3705 int sz=self->getNumberOfComponents();
3706 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3707 self->accumulate(tmp);
3708 return convertDblArrToPyList(tmp,sz);
3710 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3712 int sz=self->getNumberOfComponents();
3713 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3714 self->integral(isWAbs,tmp);
3715 return convertDblArrToPyList(tmp,sz);
3717 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3719 int sz=self->getNumberOfComponents();
3720 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3721 self->getWeightedAverageValue(tmp,isWAbs);
3722 return convertDblArrToPyList(tmp,sz);
3724 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3726 int sz=self->getNumberOfComponents();
3727 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3729 return convertDblArrToPyList(tmp,sz);
3731 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3733 int sz=self->getNumberOfComponents();
3734 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3736 return convertDblArrToPyList(tmp,sz);
3738 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3740 int szArr,sw,iTypppArr;
3741 std::vector<int> stdvecTyyppArr;
3742 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3743 self->renumberCells(tmp,check);
3746 void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3748 int szArr,sw,iTypppArr;
3749 std::vector<int> stdvecTyyppArr;
3750 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3751 self->renumberCellsWithoutMesh(tmp,check);
3754 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3756 int szArr,sw,iTypppArr;
3757 std::vector<int> stdvecTyyppArr;
3758 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3759 self->renumberNodes(tmp,eps);
3762 void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3764 int szArr,sw,iTypppArr;
3765 std::vector<int> stdvecTyyppArr;
3766 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3767 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
3770 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3774 std::vector<int> multiVal;
3775 std::pair<int, std::pair<int,int> > slic;
3776 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3777 const MEDCouplingMesh *mesh=self->getMesh();
3779 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3780 int nbc=mesh->getNumberOfCells();
3781 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3788 std::ostringstream oss;
3789 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3790 throw INTERP_KERNEL::Exception(oss.str().c_str());
3793 return self->buildSubPart(&singleVal,&singleVal+1);
3798 int tmp=nbc+singleVal;
3799 return self->buildSubPart(&tmp,&tmp+1);
3803 std::ostringstream oss;
3804 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3805 throw INTERP_KERNEL::Exception(oss.str().c_str());
3811 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3815 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3820 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3821 daIntTyypp->checkAllocated();
3822 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3825 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3829 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3831 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";
3832 if(PyTuple_Check(li))
3834 Py_ssize_t sz=PyTuple_Size(li);
3836 throw INTERP_KERNEL::Exception(msg);
3837 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3840 std::vector<int> multiVal;
3841 std::pair<int, std::pair<int,int> > slic;
3842 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3843 if(!self->getArray())
3844 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3846 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3847 catch(INTERP_KERNEL::Exception& e)
3848 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3849 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3850 DataArrayDouble *ret0Arr=ret0->getArray();
3852 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3857 std::vector<int> v2(1,singleVal);
3858 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3859 ret0->setArray(aarr);
3864 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3865 ret0->setArray(aarr);
3870 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3871 std::vector<int> v2(nbOfComp);
3872 for(int i=0;i<nbOfComp;i++)
3873 v2[i]=slic.first+i*slic.second.second;
3874 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3875 ret0->setArray(aarr);
3879 throw INTERP_KERNEL::Exception(msg);
3884 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3887 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3890 double r1=self->getMaxValue2(tmp);
3891 PyObject *ret=PyTuple_New(2);
3892 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3893 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3897 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3900 double r1=self->getMinValue2(tmp);
3901 PyObject *ret=PyTuple_New(2);
3902 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3903 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3907 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3909 std::vector<int> tmp;
3910 convertPyToNewIntArr3(li,tmp);
3911 return self->keepSelectedComponents(tmp);
3914 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3916 std::vector<int> tmp;
3917 convertPyToNewIntArr3(li,tmp);
3918 self->setSelectedComponents(f,tmp);
3921 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3924 DataArrayDouble *a,*a2;
3925 DataArrayDoubleTuple *aa,*aa2;
3926 std::vector<double> bb,bb2;
3929 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
3930 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
3931 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3932 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3934 return self->extractSlice3D(orig,vect,eps);
3937 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3939 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
3942 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3944 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
3947 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3949 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.";
3950 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
3953 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3955 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3957 return (*self)-(*other);
3959 throw INTERP_KERNEL::Exception(msg);
3964 DataArrayDoubleTuple *aa;
3965 std::vector<double> bb;
3967 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3972 if(!self->getArray())
3973 throw INTERP_KERNEL::Exception(msg2);
3974 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3975 ret->applyLin(1.,-val);
3976 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3977 ret2->setArray(ret);
3982 if(!self->getArray())
3983 throw INTERP_KERNEL::Exception(msg2);
3984 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
3985 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3986 ret2->setArray(ret);
3991 if(!self->getArray())
3992 throw INTERP_KERNEL::Exception(msg2);
3993 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3994 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3995 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3996 ret2->setArray(ret);
4001 if(!self->getArray())
4002 throw INTERP_KERNEL::Exception(msg2);
4003 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4004 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
4005 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4006 ret2->setArray(ret);
4010 { throw INTERP_KERNEL::Exception(msg); }
4014 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4016 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
4019 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4021 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
4024 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4026 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
4029 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4031 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.";
4032 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
4035 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4037 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4039 return (*self)/(*other);
4041 throw INTERP_KERNEL::Exception(msg);
4046 DataArrayDoubleTuple *aa;
4047 std::vector<double> bb;
4049 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4055 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
4056 if(!self->getArray())
4057 throw INTERP_KERNEL::Exception(msg2);
4058 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
4059 ret->applyLin(1./val,0);
4060 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4061 ret2->setArray(ret);
4066 if(!self->getArray())
4067 throw INTERP_KERNEL::Exception(msg2);
4068 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
4069 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4070 ret2->setArray(ret);
4075 if(!self->getArray())
4076 throw INTERP_KERNEL::Exception(msg2);
4077 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4078 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4079 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4080 ret2->setArray(ret);
4085 if(!self->getArray())
4086 throw INTERP_KERNEL::Exception(msg2);
4087 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4088 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4089 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4090 ret2->setArray(ret);
4094 { throw INTERP_KERNEL::Exception(msg); }
4098 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4100 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
4103 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4105 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.";
4106 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
4109 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4111 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4113 return (*self)^(*other);
4115 throw INTERP_KERNEL::Exception(msg);
4120 DataArrayDoubleTuple *aa;
4121 std::vector<double> bb;
4123 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4128 if(!self->getArray())
4129 throw INTERP_KERNEL::Exception(msg2);
4130 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
4132 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4133 ret2->setArray(ret);
4138 if(!self->getArray())
4139 throw INTERP_KERNEL::Exception(msg2);
4140 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
4141 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4142 ret2->setArray(ret);
4147 if(!self->getArray())
4148 throw INTERP_KERNEL::Exception(msg2);
4149 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4150 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4151 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4152 ret2->setArray(ret);
4157 if(!self->getArray())
4158 throw INTERP_KERNEL::Exception(msg2);
4159 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4160 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4161 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4162 ret2->setArray(ret);
4166 { throw INTERP_KERNEL::Exception(msg); }
4170 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
4172 return self->negate();
4175 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4177 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.";
4178 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
4181 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4183 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4187 Py_XINCREF(trueSelf);
4191 throw INTERP_KERNEL::Exception(msg);
4196 DataArrayDoubleTuple *aa;
4197 std::vector<double> bb;
4199 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4204 if(!self->getArray())
4205 throw INTERP_KERNEL::Exception(msg2);
4206 self->getArray()->applyLin(1.,val);
4207 Py_XINCREF(trueSelf);
4212 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4215 Py_XINCREF(trueSelf);
4220 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4221 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4222 ret2->setArray(aaa);
4224 Py_XINCREF(trueSelf);
4229 if(!self->getArray())
4230 throw INTERP_KERNEL::Exception(msg2);
4231 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4232 self->getArray()->addEqual(aaa);
4233 Py_XINCREF(trueSelf);
4237 { throw INTERP_KERNEL::Exception(msg); }
4241 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4243 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.";
4244 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4247 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4249 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4253 Py_XINCREF(trueSelf);
4257 throw INTERP_KERNEL::Exception(msg);
4262 DataArrayDoubleTuple *aa;
4263 std::vector<double> bb;
4265 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4270 if(!self->getArray())
4271 throw INTERP_KERNEL::Exception(msg2);
4272 self->getArray()->applyLin(1.,-val);
4273 Py_XINCREF(trueSelf);
4278 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4281 Py_XINCREF(trueSelf);
4286 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4287 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4288 ret2->setArray(aaa);
4290 Py_XINCREF(trueSelf);
4295 if(!self->getArray())
4296 throw INTERP_KERNEL::Exception(msg2);
4297 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4298 self->getArray()->substractEqual(aaa);
4299 Py_XINCREF(trueSelf);
4303 { throw INTERP_KERNEL::Exception(msg); }
4307 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4309 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.";
4310 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4313 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4315 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4319 Py_XINCREF(trueSelf);
4323 throw INTERP_KERNEL::Exception(msg);
4328 DataArrayDoubleTuple *aa;
4329 std::vector<double> bb;
4331 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4336 if(!self->getArray())
4337 throw INTERP_KERNEL::Exception(msg2);
4338 self->getArray()->applyLin(val,0);
4339 Py_XINCREF(trueSelf);
4344 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4347 Py_XINCREF(trueSelf);
4352 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4353 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4354 ret2->setArray(aaa);
4356 Py_XINCREF(trueSelf);
4361 if(!self->getArray())
4362 throw INTERP_KERNEL::Exception(msg2);
4363 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4364 self->getArray()->multiplyEqual(aaa);
4365 Py_XINCREF(trueSelf);
4369 { throw INTERP_KERNEL::Exception(msg); }
4373 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4375 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.";
4376 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4379 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4381 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4385 Py_XINCREF(trueSelf);
4389 throw INTERP_KERNEL::Exception(msg);
4394 DataArrayDoubleTuple *aa;
4395 std::vector<double> bb;
4397 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4403 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4404 if(!self->getArray())
4405 throw INTERP_KERNEL::Exception(msg2);
4406 self->getArray()->applyLin(1./val,0);
4407 Py_XINCREF(trueSelf);
4412 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4415 Py_XINCREF(trueSelf);
4420 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4421 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4422 ret2->setArray(aaa);
4424 Py_XINCREF(trueSelf);
4429 if(!self->getArray())
4430 throw INTERP_KERNEL::Exception(msg2);
4431 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4432 self->getArray()->divideEqual(aaa);
4433 Py_XINCREF(trueSelf);
4437 { throw INTERP_KERNEL::Exception(msg); }
4441 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4443 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.";
4444 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4447 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4449 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4453 Py_XINCREF(trueSelf);
4457 throw INTERP_KERNEL::Exception(msg);
4462 DataArrayDoubleTuple *aa;
4463 std::vector<double> bb;
4465 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4470 if(!self->getArray())
4471 throw INTERP_KERNEL::Exception(msg2);
4472 self->getArray()->applyPow(val);
4473 Py_XINCREF(trueSelf);
4478 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4481 Py_XINCREF(trueSelf);
4486 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4487 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4488 ret2->setArray(aaa);
4490 Py_XINCREF(trueSelf);
4495 if(!self->getArray())
4496 throw INTERP_KERNEL::Exception(msg2);
4497 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4498 self->getArray()->powEqual(aaa);
4499 Py_XINCREF(trueSelf);
4503 { throw INTERP_KERNEL::Exception(msg); }
4507 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4509 std::vector<const MEDCouplingFieldDouble *> tmp;
4510 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4511 return MEDCouplingFieldDouble::MergeFields(tmp);
4514 static void WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
4516 std::vector<const MEDCouplingFieldDouble *> tmp;
4517 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4518 MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4523 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4526 int getNumberOfFields() const;
4527 MEDCouplingMultiFields *deepCpy() const;
4528 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4529 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4530 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4531 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4532 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4535 std::string __str__() const throw(INTERP_KERNEL::Exception)
4537 return self->simpleRepr();
4539 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4541 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4542 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4544 std::vector<MEDCouplingFieldDouble *> fs(sz);
4545 for(int i=0;i<sz;i++)
4546 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4547 return MEDCouplingMultiFields::New(fs);
4549 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4551 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4552 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4554 std::vector<MEDCouplingFieldDouble *> fs(sz);
4555 for(int i=0;i<sz;i++)
4556 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4557 return MEDCouplingMultiFields::New(fs);
4559 PyObject *getFields() const
4561 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4562 int sz=fields.size();
4563 PyObject *res = PyList_New(sz);
4564 for(int i=0;i<sz;i++)
4568 fields[i]->incrRef();
4569 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4573 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4578 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4580 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4584 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4587 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4589 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4591 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4593 PyObject *res = PyList_New(sz);
4594 for(int i=0;i<sz;i++)
4599 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4603 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4608 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4610 std::vector<int> refs;
4611 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4613 PyObject *res = PyList_New(sz);
4614 for(int i=0;i<sz;i++)
4619 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4623 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4627 PyObject *ret=PyTuple_New(2);
4628 PyTuple_SetItem(ret,0,res);
4629 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4632 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4634 std::vector<DataArrayDouble *> ms=self->getArrays();
4636 PyObject *res = PyList_New(sz);
4637 for(int i=0;i<sz;i++)
4642 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4646 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4651 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4653 std::vector< std::vector<int> > refs;
4654 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4656 PyObject *res = PyList_New(sz);
4657 PyObject *res2 = PyList_New(sz);
4658 for(int i=0;i<sz;i++)
4663 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4667 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4669 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4672 PyObject *ret=PyTuple_New(2);
4673 PyTuple_SetItem(ret,0,res);
4674 PyTuple_SetItem(ret,1,res2);
4680 class MEDCouplingDefinitionTime
4683 MEDCouplingDefinitionTime();
4684 void assign(const MEDCouplingDefinitionTime& other);
4685 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4686 double getTimeResolution() const;
4687 std::vector<double> getHotSpotsTime() const;
4690 std::string __str__() const throw(INTERP_KERNEL::Exception)
4692 std::ostringstream oss;
4693 self->appendRepr(oss);
4697 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4699 int meshId,arrId,arrIdInField,fieldId;
4700 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4701 PyObject *res=PyList_New(4);
4702 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4703 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4704 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4705 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4709 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4711 int meshId,arrId,arrIdInField,fieldId;
4712 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4713 PyObject *res=PyList_New(4);
4714 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4715 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4716 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4717 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4723 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4726 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4727 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4731 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4733 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4734 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4736 std::vector<MEDCouplingFieldDouble *> fs(sz);
4737 for(int i=0;i<sz;i++)
4738 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4739 return MEDCouplingFieldOverTime::New(fs);
4741 std::string __str__() const throw(INTERP_KERNEL::Exception)
4743 return self->simpleRepr();
4745 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4747 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4748 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4750 std::vector<MEDCouplingFieldDouble *> fs(sz);
4751 for(int i=0;i<sz;i++)
4752 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4753 return MEDCouplingFieldOverTime::New(fs);
4758 class MEDCouplingCartesianAMRMesh;
4760 class MEDCouplingCartesianAMRPatchGen : public RefCountObject
4763 int getNumberOfCellsRecursiveWithOverlap() const throw(INTERP_KERNEL::Exception);
4764 int getNumberOfCellsRecursiveWithoutOverlap() const throw(INTERP_KERNEL::Exception);
4765 int getMaxNumberOfLevelsRelativeToThis() const throw(INTERP_KERNEL::Exception);
4768 MEDCouplingCartesianAMRMeshGen *getMesh() const throw(INTERP_KERNEL::Exception)
4770 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
4778 class MEDCouplingCartesianAMRPatch : public MEDCouplingCartesianAMRPatchGen
4781 int getNumberOfOverlapedCellsForFather() const throw(INTERP_KERNEL::Exception);
4782 bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const throw(INTERP_KERNEL::Exception);
4785 PyObject *getBLTRRange() const throw(INTERP_KERNEL::Exception)
4787 const std::vector< std::pair<int,int> >& ret(self->getBLTRRange());
4788 return convertFromVectorPairInt(ret);
4791 void addPatch(PyObject *bottomLeftTopRight, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception)
4793 std::vector< std::pair<int,int> > inp;
4794 convertPyToVectorPairInt(bottomLeftTopRight,inp);
4795 self->addPatch(inp,factors);
4798 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const throw(INTERP_KERNEL::Exception)
4800 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
4802 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatchGen.__getitem__ : no underlying mesh !");
4803 if(patchId==mesh->getNumberOfPatches())
4805 std::ostringstream oss;
4806 oss << "Requesting for patchId " << patchId << " having only " << mesh->getNumberOfPatches() << " patches !";
4807 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4810 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(mesh->getPatch(patchId)));
4816 void __delitem__(int patchId) throw(INTERP_KERNEL::Exception)
4818 MEDCouplingCartesianAMRMeshGen *mesh(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getMesh()));
4820 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__delitem__ : no underlying mesh !");
4821 mesh->removePatch(patchId);
4824 int __len__() const throw(INTERP_KERNEL::Exception)
4826 const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh());
4828 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__len__ : no underlying mesh !");
4829 return mesh->getNumberOfPatches();
4834 class MEDCouplingCartesianAMRPatchGF : public MEDCouplingCartesianAMRPatchGen
4838 class MEDCouplingDataForGodFather : public RefCountObject
4842 class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel
4845 int getAbsoluteLevel() const throw(INTERP_KERNEL::Exception);
4846 int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
4847 const std::vector<int>& getFactors() const throw(INTERP_KERNEL::Exception);
4848 void setFactors(const std::vector<int>& newFactors) throw(INTERP_KERNEL::Exception);
4849 int getMaxNumberOfLevelsRelativeToThis() const throw(INTERP_KERNEL::Exception);
4850 int getNumberOfCellsAtCurrentLevel() const throw(INTERP_KERNEL::Exception);
4851 int getNumberOfCellsRecursiveWithOverlap() const throw(INTERP_KERNEL::Exception);
4852 int getNumberOfCellsRecursiveWithoutOverlap() const throw(INTERP_KERNEL::Exception);
4853 bool isPatchInNeighborhoodOf(int patchId1, int patchId2, int ghostLev) const throw(INTERP_KERNEL::Exception);
4855 int getNumberOfPatches() const throw(INTERP_KERNEL::Exception);
4856 MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
4857 MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const throw(INTERP_KERNEL::Exception);
4858 MEDCoupling1SGTUMesh *buildMeshOfDirectChildrenOnly() const throw(INTERP_KERNEL::Exception);
4859 void removeAllPatches() throw(INTERP_KERNEL::Exception);
4860 void removePatch(int patchId) throw(INTERP_KERNEL::Exception);
4861 void detachFromFather() throw(INTERP_KERNEL::Exception);
4862 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception);
4863 DataArrayDouble *createCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis) const throw(INTERP_KERNEL::Exception);
4864 void fillCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch) const throw(INTERP_KERNEL::Exception);
4865 void fillCellFieldOnPatchGhost(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev) const throw(INTERP_KERNEL::Exception);
4866 void fillCellFieldComingFromPatch(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis) const throw(INTERP_KERNEL::Exception);
4867 void fillCellFieldComingFromPatchGhost(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, int ghostLev) const throw(INTERP_KERNEL::Exception);
4868 DataArrayInt *findPatchesInTheNeighborhoodOf(int patchId, int ghostLev) const throw(INTERP_KERNEL::Exception);
4871 void addPatch(PyObject *bottomLeftTopRight, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception)
4873 std::vector< std::pair<int,int> > inp;
4874 convertPyToVectorPairInt(bottomLeftTopRight,inp);
4875 self->addPatch(inp,factors);
4878 PyObject *retrieveGridsAt(int absoluteLev) const throw(INTERP_KERNEL::Exception)
4880 std::vector<MEDCouplingCartesianAMRPatchGen *> ps(self->retrieveGridsAt(absoluteLev));
4882 PyObject *ret = PyList_New(sz);
4883 for(int i=0;i<sz;i++)
4884 PyList_SetItem(ret,i,convertCartesianAMRPatch(ps[i], SWIG_POINTER_OWN | 0 ));
4888 MEDCouplingCartesianAMRMeshGen *getFather() const throw(INTERP_KERNEL::Exception)
4890 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getFather()));
4896 MEDCouplingCartesianAMRMeshGen *getGodFather() const throw(INTERP_KERNEL::Exception)
4898 MEDCouplingCartesianAMRMeshGen *ret(const_cast<MEDCouplingCartesianAMRMeshGen *>(self->getGodFather()));
4904 MEDCouplingCartesianAMRPatch *getPatch(int patchId) const throw(INTERP_KERNEL::Exception)
4906 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
4912 MEDCouplingIMesh *getImageMesh() const throw(INTERP_KERNEL::Exception)
4914 const MEDCouplingIMesh *ret(self->getImageMesh());
4917 return const_cast<MEDCouplingIMesh *>(ret);
4920 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const throw(INTERP_KERNEL::Exception)
4922 if(patchId==self->getNumberOfPatches())
4924 std::ostringstream oss;
4925 oss << "Requesting for patchId " << patchId << " having only " << self->getNumberOfPatches() << " patches !";
4926 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4929 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
4935 void fillCellFieldOnPatchGhostAdv(int patchId, const DataArrayDouble *cellFieldOnThis, int ghostLev, PyObject *arrsOnPatches) const throw(INTERP_KERNEL::Exception)
4937 std::vector<const ParaMEDMEM::DataArrayDouble *> arrsOnPatches2;
4938 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayDouble *>(arrsOnPatches,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",arrsOnPatches2);
4939 self->fillCellFieldOnPatchGhostAdv(patchId,cellFieldOnThis,ghostLev,arrsOnPatches2);
4942 void __delitem__(int patchId) throw(INTERP_KERNEL::Exception)
4944 self->removePatch(patchId);
4947 int __len__() const throw(INTERP_KERNEL::Exception)
4949 return self->getNumberOfPatches();
4954 class MEDCouplingCartesianAMRMeshSub : public MEDCouplingCartesianAMRMeshGen
4958 class MEDCouplingCartesianAMRMesh : public MEDCouplingCartesianAMRMeshGen
4961 void setData(MEDCouplingDataForGodFather *data) throw(INTERP_KERNEL::Exception);
4964 static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
4966 static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !";
4967 static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !";
4968 const int *nodeStrctPtr(0);
4969 const double *originPtr(0),*dxyzPtr(0);
4971 std::vector<int> bb0;
4972 nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
4975 std::vector<double> bb,bb2;
4977 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
4978 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
4980 return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
4983 MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
4985 return ParaMEDMEM_MEDCouplingCartesianAMRMesh_New(meshName,spaceDim,nodeStrct,origin,dxyz);
4988 MEDCouplingDataForGodFather *getDataConst() const throw(INTERP_KERNEL::Exception)
4990 const MEDCouplingDataForGodFather *ret(self->getDataConst());
4993 return const_cast<MEDCouplingDataForGodFather *>(ret);
4996 MEDCouplingDataForGodFather *getData() throw(INTERP_KERNEL::Exception)
4998 MEDCouplingDataForGodFather *ret(self->getData());
5006 class DenseMatrix : public RefCountObject, public TimeLabel
5009 static DenseMatrix *New(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
5010 static DenseMatrix *New(DataArrayDouble *array, int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
5011 DenseMatrix *deepCpy() const throw(INTERP_KERNEL::Exception);
5012 DenseMatrix *shallowCpy() const throw(INTERP_KERNEL::Exception);
5014 int getNumberOfRows() const throw(INTERP_KERNEL::Exception);
5015 int getNumberOfCols() const throw(INTERP_KERNEL::Exception);
5016 int getNbOfElems() const throw(INTERP_KERNEL::Exception);
5017 void reBuild(DataArrayDouble *array, int nbRows=-1, int nbCols=-1) throw(INTERP_KERNEL::Exception);
5018 void reShape(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
5019 void transpose() throw(INTERP_KERNEL::Exception);
5021 bool isEqual(const DenseMatrix& other, double eps) const throw(INTERP_KERNEL::Exception);
5022 DataArrayDouble *matVecMult(const DataArrayDouble *vec) const throw(INTERP_KERNEL::Exception);
5023 static DataArrayDouble *MatVecMult(const DenseMatrix *mat, const DataArrayDouble *vec) throw(INTERP_KERNEL::Exception);
5026 DenseMatrix(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception)
5028 return DenseMatrix::New(nbRows,nbCols);
5031 DenseMatrix(DataArrayDouble *array, int nbRows, int nbCols) throw(INTERP_KERNEL::Exception)
5033 return DenseMatrix::New(array,nbRows,nbCols);
5036 PyObject *isEqualIfNotWhy(const DenseMatrix& other, double eps) const throw(INTERP_KERNEL::Exception)
5039 bool ret0=self->isEqualIfNotWhy(other,eps,ret1);
5040 PyObject *ret=PyTuple_New(2);
5041 PyObject *ret0Py=ret0?Py_True:Py_False;
5043 PyTuple_SetItem(ret,0,ret0Py);
5044 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5048 DataArrayDouble *getData() throw(INTERP_KERNEL::Exception)
5050 DataArrayDouble *ret(self->getData());
5056 DenseMatrix *__add__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5058 return ParaMEDMEM::DenseMatrix::Add(self,other);
5061 DenseMatrix *__sub__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5063 return ParaMEDMEM::DenseMatrix::Substract(self,other);
5066 DenseMatrix *__mul__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5068 return ParaMEDMEM::DenseMatrix::Multiply(self,other);
5071 DenseMatrix *__mul__(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception)
5073 return ParaMEDMEM::DenseMatrix::Multiply(self,other);
5076 PyObject *___iadd___(PyObject *trueSelf, const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5078 self->addEqual(other);
5079 Py_XINCREF(trueSelf);
5083 PyObject *___isub___(PyObject *trueSelf, const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5085 self->substractEqual(other);
5086 Py_XINCREF(trueSelf);
5090 PyObject *toNumPyMatrix() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5092 PyObject *obj(ToNumPyArrayUnderground<DataArrayDouble,double>(self->getData(),NPY_DOUBLE,"DataArrayDouble",self->getNumberOfRows(),self->getNumberOfCols()));
5102 __filename=os.environ.get('PYTHONSTARTUP')
5103 if __filename and os.path.isfile(__filename):
5104 execfile(__filename)