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);
85 %typemap(out) ParaMEDMEM::MEDCoupling1GTUMesh*
87 $result=convertMesh($1,$owner);
90 %typemap(out) MEDCoupling1GTUMesh*
92 $result=convertMesh($1,$owner);
97 %typemap(out) ParaMEDMEM::MEDCouplingStructuredMesh*
99 $result=convertMesh($1,$owner);
102 %typemap(out) MEDCouplingStructuredMesh*
104 $result=convertMesh($1,$owner);
109 %typemap(out) ParaMEDMEM::MEDCouplingFieldDiscretization*
111 $result=convertFieldDiscretization($1,$owner);
114 %typemap(out) MEDCouplingFieldDiscretization*
116 $result=convertFieldDiscretization($1,$owner);
121 %typemap(out) ParaMEDMEM::MEDCouplingMultiFields*
123 $result=convertMultiFields($1,$owner);
126 %typemap(out) MEDCouplingMultiFields*
128 $result=convertMultiFields($1,$owner);
133 %init %{ import_array(); %}
136 %feature("autodoc", "1");
137 %feature("docstring");
139 %newobject ParaMEDMEM::MEDCouplingField::buildMeasureField;
140 %newobject ParaMEDMEM::MEDCouplingField::getLocalizationOfDiscr;
141 %newobject ParaMEDMEM::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
142 %newobject ParaMEDMEM::MEDCouplingFieldDouble::New;
143 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getArray;
144 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getEndArray;
145 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MergeFields;
146 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MeldFields;
147 %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct;
148 %newobject ParaMEDMEM::MEDCouplingFieldDouble::determinant;
149 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenValues;
150 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenVectors;
151 %newobject ParaMEDMEM::MEDCouplingFieldDouble::inverse;
152 %newobject ParaMEDMEM::MEDCouplingFieldDouble::trace;
153 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deviator;
154 %newobject ParaMEDMEM::MEDCouplingFieldDouble::magnitude;
155 %newobject ParaMEDMEM::MEDCouplingFieldDouble::maxPerTuple;
156 %newobject ParaMEDMEM::MEDCouplingFieldDouble::keepSelectedComponents;
157 %newobject ParaMEDMEM::MEDCouplingFieldDouble::extractSlice3D;
158 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DotFields;
159 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dot;
160 %newobject ParaMEDMEM::MEDCouplingFieldDouble::CrossProductFields;
161 %newobject ParaMEDMEM::MEDCouplingFieldDouble::crossProduct;
162 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MaxFields;
163 %newobject ParaMEDMEM::MEDCouplingFieldDouble::max;
164 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MinFields;
165 %newobject ParaMEDMEM::MEDCouplingFieldDouble::AddFields;
166 %newobject ParaMEDMEM::MEDCouplingFieldDouble::SubstractFields;
167 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MultiplyFields;
168 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DivideFields;
169 %newobject ParaMEDMEM::MEDCouplingFieldDouble::min;
170 %newobject ParaMEDMEM::MEDCouplingFieldDouble::negate;
171 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getIdsInRange;
172 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart;
173 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPartRange;
174 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__getitem__;
175 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__neg__;
176 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__add__;
177 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__sub__;
178 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__mul__;
179 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__div__;
180 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__pow__;
181 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__radd__;
182 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rsub__;
183 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rmul__;
184 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rdiv__;
185 %newobject ParaMEDMEM::MEDCouplingFieldDouble::clone;
186 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cloneWithMesh;
187 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy;
188 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
189 %newobject ParaMEDMEM::MEDCouplingFieldDouble::nodeToCellDiscretization;
190 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cellToNodeDiscretization;
191 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
192 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
193 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
194 %newobject ParaMEDMEM::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
195 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
196 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfNodesPerCell;
197 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfFacesPerCell;
198 %newobject ParaMEDMEM::MEDCouplingMesh::computeEffectiveNbOfNodesPerCell;
199 %newobject ParaMEDMEM::MEDCouplingMesh::buildPartRange;
200 %newobject ParaMEDMEM::MEDCouplingMesh::giveCellsWithType;
201 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
202 %newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
203 %newobject ParaMEDMEM::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
204 %newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
205 %newobject ParaMEDMEM::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
206 %newobject ParaMEDMEM::MEDCouplingMesh::mergeMyselfWith;
207 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic;
208 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic2;
209 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic3;
210 %newobject ParaMEDMEM::MEDCouplingMesh::getMeasureField;
211 %newobject ParaMEDMEM::MEDCouplingMesh::simplexize;
212 %newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured;
213 %newobject ParaMEDMEM::MEDCouplingMesh::MergeMeshes;
214 %newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer;
215 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellsInBoundingBox;
216 %newobject ParaMEDMEM::MEDCouplingPointSet::findBoundaryNodes;
217 %newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh;
218 %newobject ParaMEDMEM::MEDCouplingPointSet::MergeNodesArray;
219 %newobject ParaMEDMEM::MEDCouplingPointSet::buildPartOfMySelf2;
220 %newobject ParaMEDMEM::MEDCouplingPointSet::BuildInstanceFromMeshType;
221 %newobject ParaMEDMEM::MEDCouplingPointSet::zipConnectivityTraducer;
222 %newobject ParaMEDMEM::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
223 %newobject ParaMEDMEM::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
224 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellIdsLyingOnNodes;
225 %newobject ParaMEDMEM::MEDCouplingPointSet::deepCpyConnectivityOnly;
226 %newobject ParaMEDMEM::MEDCouplingPointSet::getBoundingBoxForBBTree;
227 %newobject ParaMEDMEM::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells;
228 %newobject ParaMEDMEM::MEDCouplingPointSet::__getitem__;
229 %newobject ParaMEDMEM::MEDCouplingUMesh::New;
230 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
231 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
232 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
233 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
234 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
235 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
236 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
237 %newobject ParaMEDMEM::MEDCouplingUMesh::explode3DMeshTo1D;
238 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
239 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
240 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
241 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
242 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
243 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
244 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
245 %newobject ParaMEDMEM::MEDCouplingUMesh::conformize2D;
246 %newobject ParaMEDMEM::MEDCouplingUMesh::colinearize2D;
247 %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
248 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
249 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
250 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
251 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
252 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
253 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
254 %newobject ParaMEDMEM::MEDCouplingUMesh::convertLinearCellsToQuadratic;
255 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
256 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
257 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
258 %newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField;
259 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner;
260 %newobject ParaMEDMEM::MEDCouplingUMesh::computePlaneEquationOf3DFaces;
261 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField;
262 %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
263 %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
264 %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
265 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
266 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
267 %newobject ParaMEDMEM::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
268 %newobject ParaMEDMEM::MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh;
269 %newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
270 %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
271 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis;
272 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsCrossingPlane;
273 %newobject ParaMEDMEM::MEDCouplingUMesh::convexEnvelop2D;
274 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
275 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf2DMesh;
276 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf3DMesh;
277 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
278 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
279 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic;
280 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
281 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
282 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::New;
283 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::getNodalConnectivity;
284 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
285 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::New;
286 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
287 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::computeDualMesh;
288 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
289 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::sortHexa8EachOther;
290 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
291 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
292 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::New;
293 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
294 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
295 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
296 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
297 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
298 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
299 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::buildStructuredSubPart;
300 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTUnstructured;
301 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTSubLevelMesh;
302 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
303 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
304 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh;
305 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
306 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
307 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
308 %newobject ParaMEDMEM::MEDCouplingIMesh::New;
309 %newobject ParaMEDMEM::MEDCouplingIMesh::asSingleCell;
310 %newobject ParaMEDMEM::MEDCouplingIMesh::buildWithGhost;
311 %newobject ParaMEDMEM::MEDCouplingIMesh::convertToCartesian;
312 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
313 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
314 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
315 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
316 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
317 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
318 %newobject ParaMEDMEM::MEDCouplingCartesianAMRPatch::getMesh;
319 %newobject ParaMEDMEM::MEDCouplingCartesianAMRPatch::__getitem__;
320 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::New;
321 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::buildUnstructured;
322 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::buildMeshFromPatchEnvelop;
323 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getImageMesh;
324 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getGodFather;
325 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getFather;
326 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getPatch;
327 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::createCellFieldOnPatch;
328 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::__getitem__;
329 %newobject ParaMEDMEM::DenseMatrix::New;
330 %newobject ParaMEDMEM::DenseMatrix::deepCpy;
331 %newobject ParaMEDMEM::DenseMatrix::shallowCpy;
332 %newobject ParaMEDMEM::DenseMatrix::getData;
333 %newobject ParaMEDMEM::DenseMatrix::matVecMult;
334 %newobject ParaMEDMEM::DenseMatrix::MatVecMult;
335 %newobject ParaMEDMEM::DenseMatrix::__add__;
336 %newobject ParaMEDMEM::DenseMatrix::__sub__;
337 %newobject ParaMEDMEM::DenseMatrix::__mul__;
339 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
340 %feature("unref") MEDCouplingMesh "$this->decrRef();"
341 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
342 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
343 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
344 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
345 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
346 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
347 %feature("unref") MEDCouplingIMesh "$this->decrRef();"
348 %feature("unref") MEDCouplingCurveLinearMesh "$this->decrRef();"
349 %feature("unref") MEDCouplingField "$this->decrRef();"
350 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
351 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
352 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
353 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
354 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
355 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
356 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
357 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
358 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
359 %feature("unref") MEDCouplingCartesianAMRMesh "$this->decrRef();"
360 %feature("unref") MEDCouplingCartesianAMRPatch "$this->decrRef();"
361 %feature("unref") DenseMatrix "$this->decrRef();"
363 %rename(assign) *::operator=;
364 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
365 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
366 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
367 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
371 %rename (InterpKernelException) INTERP_KERNEL::Exception;
373 %include "MEDCouplingRefCountObject.i"
374 %include "MEDCouplingMemArray.i"
376 namespace INTERP_KERNEL
379 * \class BoxSplittingOptions
380 * Class defining the options for box splitting used for AMR algorithm like creation of patches following a criterion.
382 class BoxSplittingOptions
385 BoxSplittingOptions();
386 void init() throw(INTERP_KERNEL::Exception);
387 double getEffeciency() const throw(INTERP_KERNEL::Exception);
388 void setEffeciency(double effeciency) throw(INTERP_KERNEL::Exception);
389 double getEffeciencySnd() const throw(INTERP_KERNEL::Exception);
390 void setEffeciencySnd(double effeciencySnd) throw(INTERP_KERNEL::Exception);
391 int getMinCellDirection() const throw(INTERP_KERNEL::Exception);
392 void setMinCellDirection(int minCellDirection) throw(INTERP_KERNEL::Exception);
393 int getMaxCells() const throw(INTERP_KERNEL::Exception);
394 void setMaxCells(int maxCells) throw(INTERP_KERNEL::Exception);
395 void copyOptions(const BoxSplittingOptions & other) throw(INTERP_KERNEL::Exception);
396 std::string printOptions() const throw(INTERP_KERNEL::Exception);
399 std::string __str__() const throw(INTERP_KERNEL::Exception)
401 return self->printOptions();
423 CONST_ON_TIME_INTERVAL = 7
424 } TypeOfTimeDiscretization;
432 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
433 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
435 } MEDCouplingMeshType;
438 class DataArrayDouble;
439 class MEDCouplingUMesh;
440 class MEDCouplingFieldDouble;
442 %extend RefCountObject
444 std::string getHiddenCppPointer() const
446 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
451 %extend MEDCouplingGaussLocalization
453 std::string __str__() const throw(INTERP_KERNEL::Exception)
455 return self->getStringRepr();
458 std::string __repr__() const throw(INTERP_KERNEL::Exception)
460 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
461 oss << self->getStringRepr();
468 class MEDCouplingMesh : public RefCountObject, public TimeLabel
471 void setName(const std::string& name);
472 std::string getName() const;
473 void setDescription(const std::string& descr);
474 std::string getDescription() const;
475 void setTime(double val, int iteration, int order);
476 void setTimeUnit(const std::string& unit);
477 std::string getTimeUnit() const;
478 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
479 bool isStructured() const throw(INTERP_KERNEL::Exception);
480 virtual MEDCouplingMesh *deepCpy() const;
481 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
482 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
483 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
484 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
485 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
486 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
487 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
488 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
489 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
490 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
491 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
492 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
493 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
494 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
495 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
496 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
497 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
498 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
499 virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
500 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
501 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
502 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
503 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
504 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
505 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
507 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
508 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
509 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
510 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
511 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception);
512 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
513 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
514 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
515 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
516 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
517 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
518 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
519 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
520 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
521 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
522 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
523 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
526 std::string __str__() const throw(INTERP_KERNEL::Exception)
528 return self->simpleRepr();
531 PyObject *getTime() throw(INTERP_KERNEL::Exception)
534 double tmp0=self->getTime(tmp1,tmp2);
535 PyObject *res = PyList_New(3);
536 PyList_SetItem(res,0,SWIG_From_double(tmp0));
537 PyList_SetItem(res,1,SWIG_From_int(tmp1));
538 PyList_SetItem(res,2,SWIG_From_int(tmp2));
542 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
546 DataArrayDoubleTuple *aa;
547 std::vector<double> bb;
549 int spaceDim=self->getSpaceDimension();
550 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
551 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
552 return self->getCellContainingPoint(pos,eps);
555 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
559 DataArrayDoubleTuple *aa;
560 std::vector<double> bb;
562 int spaceDim=self->getSpaceDimension();
563 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
564 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
565 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
566 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
567 PyObject *ret=PyTuple_New(2);
568 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
569 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
573 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
575 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
576 int spaceDim=self->getSpaceDimension();
578 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
579 if (!SWIG_IsOK(res1))
582 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
583 int nbOfPoints=size/spaceDim;
586 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
588 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
592 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
594 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
595 da2->checkAllocated();
596 int size=da2->getNumberOfTuples();
597 int nbOfCompo=da2->getNumberOfComponents();
598 if(nbOfCompo!=spaceDim)
600 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
602 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
604 PyObject *ret=PyTuple_New(2);
605 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
606 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
610 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
614 DataArrayDoubleTuple *aa;
615 std::vector<double> bb;
617 int spaceDim=self->getSpaceDimension();
618 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
619 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
620 std::vector<int> elts;
621 self->getCellsContainingPoint(pos,eps,elts);
622 DataArrayInt *ret=DataArrayInt::New();
623 ret->alloc((int)elts.size(),1);
624 std::copy(elts.begin(),elts.end(),ret->getPointer());
625 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
628 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
630 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
631 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
632 self->getReverseNodalConnectivity(d0,d1);
633 PyObject *ret=PyTuple_New(2);
634 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
635 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
639 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
642 int v0; std::vector<int> v1;
643 const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
644 self->renumberCells(ids,check);
647 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
649 DataArrayInt *cellCor, *nodeCor;
650 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
651 PyObject *res = PyList_New(2);
652 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
653 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
657 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
659 DataArrayInt *cellCor=0,*nodeCor=0;
660 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
661 PyObject *res = PyList_New(2);
662 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
663 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
667 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
669 DataArrayInt *cellCor=0;
670 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
674 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
677 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
678 if (!SWIG_IsOK(res1))
681 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
682 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
686 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
688 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
689 da2->checkAllocated();
690 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
693 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
695 std::vector<int> conn;
696 self->getNodeIdsOfCell(cellId,conn);
697 return convertIntArrToPyList2(conn);
700 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
702 std::vector<double> coo;
703 self->getCoordinatesOfNode(nodeId,coo);
704 return convertDblArrToPyList2(coo);
707 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
711 DataArrayDoubleTuple *aa;
712 std::vector<double> bb;
714 int spaceDim=self->getSpaceDimension();
715 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
716 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
717 self->scale(pointPtr,factor);
720 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
722 int spaceDim=self->getSpaceDimension();
723 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
724 self->getBoundingBox(tmp);
725 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
729 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
732 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
733 PyObject *ret=PyTuple_New(2);
734 PyObject *ret0Py=ret0?Py_True:Py_False;
736 PyTuple_SetItem(ret,0,ret0Py);
737 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
741 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
743 int szArr,sw,iTypppArr;
744 std::vector<int> stdvecTyyppArr;
745 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
746 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
747 if(sw==3)//DataArrayInt
749 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
750 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
751 std::string name=argpt->getName();
753 ret->setName(name.c_str());
755 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
758 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
760 int szArr,sw,iTypppArr;
761 std::vector<int> stdvecTyyppArr;
763 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
764 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
765 if(sw==3)//DataArrayInt
767 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
768 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
769 std::string name=argpt->getName();
771 ret->setName(name.c_str());
774 PyObject *res = PyList_New(2);
775 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
776 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
777 PyList_SetItem(res,0,obj0);
778 PyList_SetItem(res,1,obj1);
782 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
786 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
787 PyObject *res = PyTuple_New(2);
788 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
791 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
793 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
794 PyTuple_SetItem(res,0,obj0);
795 PyTuple_SetItem(res,1,obj1);
799 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
801 std::vector<int> vals=self->getDistributionOfTypes();
803 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
804 PyObject *ret=PyList_New((int)vals.size()/3);
805 for(int j=0;j<(int)vals.size()/3;j++)
807 PyObject *ret1=PyList_New(3);
808 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
809 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
810 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
811 PyList_SetItem(ret,j,ret1);
816 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
818 std::vector<int> code;
819 std::vector<const DataArrayInt *> idsPerType;
820 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
821 convertPyToNewIntArr4(li,1,3,code);
822 return self->checkTypeConsistencyAndContig(code,idsPerType);
825 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
827 std::vector<int> code;
828 std::vector<DataArrayInt *> idsInPflPerType;
829 std::vector<DataArrayInt *> idsPerType;
830 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
831 PyObject *ret=PyTuple_New(3);
834 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
835 PyObject *ret0=PyList_New((int)code.size()/3);
836 for(int j=0;j<(int)code.size()/3;j++)
838 PyObject *ret00=PyList_New(3);
839 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
840 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
841 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
842 PyList_SetItem(ret0,j,ret00);
844 PyTuple_SetItem(ret,0,ret0);
846 PyObject *ret1=PyList_New(idsInPflPerType.size());
847 for(std::size_t j=0;j<idsInPflPerType.size();j++)
848 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
849 PyTuple_SetItem(ret,1,ret1);
850 int n=idsPerType.size();
851 PyObject *ret2=PyList_New(n);
853 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
854 PyTuple_SetItem(ret,2,ret2);
858 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
862 DataArrayDoubleTuple *aa;
863 std::vector<double> bb;
865 int spaceDim=self->getSpaceDimension();
866 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
867 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
868 self->translate(vectorPtr);
871 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
873 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
876 DataArrayDoubleTuple *aa;
877 std::vector<double> bb;
879 int spaceDim=self->getSpaceDimension();
880 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
881 self->rotate(centerPtr,0,alpha);
884 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
886 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
888 DataArrayDouble *a,*a2;
889 DataArrayDoubleTuple *aa,*aa2;
890 std::vector<double> bb,bb2;
892 int spaceDim=self->getSpaceDimension();
893 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
894 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
895 self->rotate(centerPtr,vectorPtr,alpha);
898 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
900 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
901 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
902 PyObject *res=PyList_New(result.size());
903 for(int i=0;iL!=result.end(); i++, iL++)
904 PyList_SetItem(res,i,PyInt_FromLong(*iL));
908 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
910 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
911 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
912 return MEDCouplingMesh::MergeMeshes(tmp);
918 //== MEDCouplingMesh End
920 %include "NormalizedGeometricTypes"
921 %include "MEDCouplingNatureOfFieldEnum"
925 class MEDCouplingNatureOfField
928 static const char *GetRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception);
929 static std::string GetReprNoThrow(NatureOfField nat);
930 static std::string GetAllPossibilitiesStr();
934 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
935 // include "MEDCouplingTimeDiscretization.i"
939 class MEDCouplingGaussLocalization
942 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
943 const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
944 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
945 INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
946 void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
947 int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
948 int getDimension() const throw(INTERP_KERNEL::Exception);
949 int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
950 std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
951 void checkCoherency() const throw(INTERP_KERNEL::Exception);
952 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception);
954 const std::vector<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
955 double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
956 const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
957 double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
958 const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
959 double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
960 void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
961 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
962 void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
963 void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
964 void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
965 void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
967 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
971 %include "MEDCouplingFieldDiscretization.i"
973 //== MEDCouplingPointSet
977 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
980 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
981 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
982 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
983 void zipCoords() throw(INTERP_KERNEL::Exception);
984 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
985 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
986 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
987 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
988 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
989 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
990 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
991 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
992 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
993 static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception);
994 virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
995 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
996 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
997 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
998 virtual DataArrayInt *findBoundaryNodes() const;
999 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
1000 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
1001 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
1002 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
1003 virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
1004 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1007 std::string __str__() const throw(INTERP_KERNEL::Exception)
1009 return self->simpleRepr();
1012 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
1015 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1016 PyObject *res = PyList_New(2);
1017 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1018 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
1022 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
1024 DataArrayInt *comm, *commIndex;
1025 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1026 PyObject *res = PyList_New(2);
1027 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1028 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1032 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
1034 DataArrayDouble *ret1=self->getCoords();
1037 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
1040 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
1042 int szArr,sw,iTypppArr;
1043 std::vector<int> stdvecTyyppArr;
1044 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1045 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1046 if(sw==3)//DataArrayInt
1048 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1049 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1050 std::string name=argpt->getName();
1052 ret->setName(name.c_str());
1054 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1057 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1059 int szArr,sw,iTypppArr;
1060 std::vector<int> stdvecTyyppArr;
1061 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1062 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1063 if(sw==3)//DataArrayInt
1065 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1066 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1067 std::string name=argpt->getName();
1069 ret->setName(name.c_str());
1071 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1074 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
1076 int szArr,sw,iTypppArr;
1077 std::vector<int> stdvecTyyppArr;
1078 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1079 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1080 if(sw==3)//DataArrayInt
1082 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1083 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1084 std::string name=argpt->getName();
1086 ret->setName(name.c_str());
1088 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1091 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1093 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1094 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1097 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) 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->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
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 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1116 int szArr,sw,iTypppArr;
1117 std::vector<int> stdvecTyyppArr;
1118 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1119 self->renumberNodes(tmp,newNbOfNodes);
1122 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1124 int szArr,sw,iTypppArr;
1125 std::vector<int> stdvecTyyppArr;
1126 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1127 self->renumberNodes2(tmp,newNbOfNodes);
1130 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1132 int spaceDim=self->getSpaceDimension();
1134 DataArrayDouble *a,*a2;
1135 DataArrayDoubleTuple *aa,*aa2;
1136 std::vector<double> bb,bb2;
1138 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1139 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1140 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1141 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1142 std::vector<int> nodes;
1143 self->findNodesOnLine(p,v,eps,nodes);
1144 DataArrayInt *ret=DataArrayInt::New();
1145 ret->alloc((int)nodes.size(),1);
1146 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1147 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1149 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1151 int spaceDim=self->getSpaceDimension();
1153 DataArrayDouble *a,*a2;
1154 DataArrayDoubleTuple *aa,*aa2;
1155 std::vector<double> bb,bb2;
1157 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1158 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1159 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1160 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1161 std::vector<int> nodes;
1162 self->findNodesOnPlane(p,v,eps,nodes);
1163 DataArrayInt *ret=DataArrayInt::New();
1164 ret->alloc((int)nodes.size(),1);
1165 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1166 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1169 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1173 DataArrayDoubleTuple *aa;
1174 std::vector<double> bb;
1176 int spaceDim=self->getSpaceDimension();
1177 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1178 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1179 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1180 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1183 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1185 DataArrayInt *c=0,*cI=0;
1189 DataArrayDoubleTuple *aa;
1190 std::vector<double> bb;
1192 int spaceDim=self->getSpaceDimension();
1193 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1194 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1195 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1196 PyObject *ret=PyTuple_New(2);
1197 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1198 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1202 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1204 DataArrayInt *c=0,*cI=0;
1205 int spaceDim=self->getSpaceDimension();
1208 DataArrayDoubleTuple *aa;
1209 std::vector<double> bb;
1212 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1213 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1215 PyObject *ret=PyTuple_New(2);
1216 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1217 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1221 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1225 DataArrayDoubleTuple *aa;
1226 std::vector<double> bb;
1228 int spaceDim=self->getSpaceDimension();
1229 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1230 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1232 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1233 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1236 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1240 std::vector<int> multiVal;
1241 std::pair<int, std::pair<int,int> > slic;
1242 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1243 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1247 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1249 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1251 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1253 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1257 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1259 DataArrayInt *v0=0,*v1=0;
1260 self->findCommonCells(compType,startCellId,v0,v1);
1261 PyObject *res = PyList_New(2);
1262 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1263 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1268 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1271 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1272 if (!SWIG_IsOK(res1))
1275 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1276 self->renumberNodesInConn(tmp);
1280 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1282 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1283 da2->checkAllocated();
1284 self->renumberNodesInConn(da2->getConstPointer());
1288 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1291 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1292 PyObject *ret=PyTuple_New(2);
1293 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1294 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1298 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1300 DataArrayInt *ret=0;
1302 int szArr,sw,iTypppArr;
1303 std::vector<int> stdvecTyyppArr;
1304 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1305 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1309 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1313 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1314 PyObject *res = PyList_New(3);
1315 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1316 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1317 PyList_SetItem(res,2,SWIG_From_int(ret2));
1321 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1325 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1326 PyObject *res = PyList_New(3);
1327 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1328 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1329 PyList_SetItem(res,2,SWIG_From_int(ret2));
1333 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1336 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1337 if (!SWIG_IsOK(res1))
1340 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1341 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1345 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1347 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1348 da2->checkAllocated();
1349 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1353 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1357 std::vector<int> multiVal;
1358 std::pair<int, std::pair<int,int> > slic;
1359 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1360 int nbc=self->getNumberOfCells();
1361 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1368 std::ostringstream oss;
1369 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1370 throw INTERP_KERNEL::Exception(oss.str().c_str());
1373 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1378 int tmp=nbc+singleVal;
1379 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1383 std::ostringstream oss;
1384 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1385 throw INTERP_KERNEL::Exception(oss.str().c_str());
1391 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1395 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1400 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1401 daIntTyypp->checkAllocated();
1402 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1405 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1409 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1412 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1413 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1414 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1415 for(int i=0;i<sz;i++)
1416 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1419 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1422 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1424 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1425 std::vector<double> val3;
1426 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1427 "Rotate2DAlg",2,true,nbNodes);
1429 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1430 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1433 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1436 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1437 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1438 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1439 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1440 for(int i=0;i<sz;i++)
1441 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1444 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1447 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1449 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1450 std::vector<double> val3;
1451 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1452 "Rotate3DAlg",3,true,nbNodes);
1454 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1455 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1456 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1461 //== MEDCouplingPointSet End
1463 class MEDCouplingUMeshCell
1466 INTERP_KERNEL::NormalizedCellType getType() const;
1469 std::string __str__() const throw(INTERP_KERNEL::Exception)
1471 return self->repr();
1474 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1477 const int *r=self->getAllConn(ret2);
1478 PyObject *ret=PyTuple_New(ret2);
1479 for(int i=0;i<ret2;i++)
1480 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1486 class MEDCouplingUMeshCellIterator
1493 MEDCouplingUMeshCell *ret=self->nextt();
1495 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1498 PyErr_SetString(PyExc_StopIteration,"No more data.");
1505 class MEDCouplingUMeshCellByTypeIterator
1508 ~MEDCouplingUMeshCellByTypeIterator();
1513 MEDCouplingUMeshCellEntry *ret=self->nextt();
1515 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1518 PyErr_SetString(PyExc_StopIteration,"No more data.");
1525 class MEDCouplingUMeshCellByTypeEntry
1528 ~MEDCouplingUMeshCellByTypeEntry();
1531 MEDCouplingUMeshCellByTypeIterator *__iter__()
1533 return self->iterator();
1538 class MEDCouplingUMeshCellEntry
1541 INTERP_KERNEL::NormalizedCellType getType() const;
1542 int getNumberOfElems() const;
1545 MEDCouplingUMeshCellIterator *__iter__()
1547 return self->iterator();
1552 //== MEDCouplingUMesh
1554 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1557 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1558 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1559 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1560 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1561 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1562 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1563 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1564 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1565 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1566 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1567 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1568 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1569 void computeTypes() throw(INTERP_KERNEL::Exception);
1570 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1571 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1573 DataArrayInt *conformize2D(double eps) throw(INTERP_KERNEL::Exception);
1574 DataArrayInt *colinearize2D(double eps) throw(INTERP_KERNEL::Exception);
1575 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1576 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1577 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1578 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1579 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1580 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1581 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1582 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1583 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1584 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1585 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1586 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1587 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1588 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1589 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1590 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1591 bool isFullyQuadratic() const throw(INTERP_KERNEL::Exception);
1592 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1593 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1594 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1595 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1596 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1597 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1598 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1599 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1600 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1601 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1602 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1603 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1604 DataArrayDouble *computePlaneEquationOf3DFaces() const throw(INTERP_KERNEL::Exception);
1605 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1606 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1607 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1608 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1609 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1610 DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1611 DataArrayInt *buildUnionOf2DMesh() const throw(INTERP_KERNEL::Exception);
1612 DataArrayInt *buildUnionOf3DMesh() const throw(INTERP_KERNEL::Exception);
1613 DataArrayDouble *getBoundingBoxForBBTreeFast() const throw(INTERP_KERNEL::Exception);
1614 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1615 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1616 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);
1617 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1618 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1619 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1620 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1621 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1623 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1625 return MEDCouplingUMesh::New();
1628 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1630 return MEDCouplingUMesh::New(meshName,meshDim);
1633 std::string __str__() const throw(INTERP_KERNEL::Exception)
1635 return self->simpleRepr();
1638 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1640 std::ostringstream oss;
1641 self->reprQuickOverview(oss);
1645 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1647 return self->cellIterator();
1650 PyObject *getAllGeoTypesSorted() const throw(INTERP_KERNEL::Exception)
1652 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
1653 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1654 PyObject *res=PyList_New(result.size());
1655 for(int i=0;iL!=result.end(); i++, iL++)
1656 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1660 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1664 std::vector<int> multiVal;
1665 std::pair<int, std::pair<int,int> > slic;
1666 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1667 int nbc=self->getNumberOfCells();
1668 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1675 std::ostringstream oss;
1676 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1677 throw INTERP_KERNEL::Exception(oss.str().c_str());
1681 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1688 int tmp=nbc+singleVal;
1689 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1694 std::ostringstream oss;
1695 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1696 throw INTERP_KERNEL::Exception(oss.str().c_str());
1702 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1708 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1709 daIntTyypp->checkAllocated();
1710 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1714 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1718 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1722 std::vector<int> multiVal;
1723 std::pair<int, std::pair<int,int> > slic;
1724 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1725 int nbc=self->getNumberOfCells();
1726 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1733 std::ostringstream oss;
1734 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1735 throw INTERP_KERNEL::Exception(oss.str().c_str());
1739 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1746 int tmp=nbc+singleVal;
1747 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1752 std::ostringstream oss;
1753 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1754 throw INTERP_KERNEL::Exception(oss.str().c_str());
1760 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1765 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1771 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1772 daIntTyypp->checkAllocated();
1773 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1777 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1781 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1783 int szArr,sw,iTypppArr;
1784 std::vector<int> stdvecTyyppArr;
1785 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1788 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1789 throw INTERP_KERNEL::Exception(oss.str().c_str());
1791 self->insertNextCell(type,size,tmp);
1794 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1796 int szArr,sw,iTypppArr;
1797 std::vector<int> stdvecTyyppArr;
1798 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1799 self->insertNextCell(type,szArr,tmp);
1802 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1804 DataArrayInt *ret=self->getNodalConnectivity();
1809 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1811 DataArrayInt *ret=self->getNodalConnectivityIndex();
1817 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1819 int szArr,sw,iTypppArr;
1820 std::vector<int> stdvecTyyppArr;
1821 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1822 int nbOfDepthPeelingPerformed=0;
1823 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1824 PyObject *res=PyTuple_New(2);
1825 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1826 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1830 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1832 DataArrayInt *v0=0,*v1=0;
1833 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1834 PyObject *res = PyList_New(2);
1835 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1836 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1840 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1844 DataArrayDoubleTuple *aa;
1845 std::vector<double> bb;
1847 int nbOfCompo=self->getSpaceDimension();
1848 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1851 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1852 PyObject *ret=PyTuple_New(2);
1853 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1854 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1858 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1860 DataArrayInt *ret1=0;
1861 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1862 PyObject *ret=PyTuple_New(2);
1863 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1864 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1868 PyObject *tetrahedrize(int policy) throw(INTERP_KERNEL::Exception)
1871 DataArrayInt *ret1(0);
1872 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
1873 PyObject *ret=PyTuple_New(3);
1874 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
1875 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1876 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
1880 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1882 std::vector<int> cells;
1883 self->checkButterflyCells(cells,eps);
1884 DataArrayInt *ret=DataArrayInt::New();
1885 ret->alloc((int)cells.size(),1);
1886 std::copy(cells.begin(),cells.end(),ret->getPointer());
1887 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1890 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1892 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1894 PyObject *ret = PyList_New(sz);
1895 for(int i=0;i<sz;i++)
1896 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1900 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1902 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1903 int sz=retCpp.size();
1904 PyObject *ret=PyList_New(sz);
1905 for(int i=0;i<sz;i++)
1906 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1910 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1913 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1914 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1915 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1918 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1921 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1922 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1926 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1929 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1930 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1934 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1936 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1937 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1938 PyObject *ret=PyTuple_New(3);
1939 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1940 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1941 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1945 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1947 DataArrayInt *tmp0=0,*tmp1=0;
1948 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1949 PyObject *ret=PyTuple_New(2);
1950 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1951 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1955 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1959 std::vector<int> multiVal;
1960 std::pair<int, std::pair<int,int> > slic;
1961 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1962 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1966 return self->duplicateNodes(&singleVal,&singleVal+1);
1968 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
1970 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
1972 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1976 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
1980 std::vector<int> multiVal;
1981 std::pair<int, std::pair<int,int> > slic;
1982 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1983 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1987 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
1989 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
1991 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
1993 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1997 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
2000 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
2001 DataArrayInt *tmp0,*tmp1=0;
2002 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2003 PyObject *ret=PyTuple_New(2);
2004 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2005 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2009 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const throw(INTERP_KERNEL::Exception)
2011 DataArrayInt *ret0=0,*ret1=0;
2012 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
2013 PyObject *ret=PyTuple_New(2);
2014 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2015 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2019 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2021 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2022 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2023 DataArrayInt *ret1=0,*ret2=0;
2024 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2025 PyObject *ret=PyTuple_New(3);
2026 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2027 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2028 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2032 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2034 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2035 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2036 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2037 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2040 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
2043 std::vector<const MEDCouplingUMesh *> meshes;
2044 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2045 std::vector<DataArrayInt *> corr;
2046 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2048 PyObject *ret1=PyList_New(sz);
2049 for(int i=0;i<sz;i++)
2050 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2051 PyObject *ret=PyList_New(2);
2052 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2053 PyList_SetItem(ret,1,ret1);
2057 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2059 std::vector<MEDCouplingUMesh *> meshes;
2060 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2061 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2064 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
2066 std::vector<MEDCouplingUMesh *> meshes;
2067 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2068 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2071 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
2075 std::vector<int> multiVal;
2076 std::pair<int, std::pair<int,int> > slic;
2077 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2079 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2080 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2084 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2086 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2088 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2090 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2094 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2096 DataArrayInt *arrOut=0,*arrIndexOut=0;
2099 std::vector<int> multiVal;
2100 std::pair<int, std::pair<int,int> > slic;
2101 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2103 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2104 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2109 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2114 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2119 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2123 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2125 PyObject *ret=PyTuple_New(2);
2126 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2127 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2131 static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2133 DataArrayInt *arrOut=0,*arrIndexOut=0;
2134 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2135 PyObject *ret=PyTuple_New(2);
2136 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2137 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2141 static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2143 if(!PySlice_Check(slic))
2144 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !");
2145 Py_ssize_t strt=2,stp=2,step=2;
2146 PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
2148 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !");
2149 arrIndxIn->checkAllocated();
2150 if(arrIndxIn->getNumberOfComponents()!=1)
2151 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !");
2152 GetIndicesOfSlice(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !");
2153 DataArrayInt *arrOut=0,*arrIndexOut=0;
2154 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2155 PyObject *ret=PyTuple_New(2);
2156 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2157 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2161 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2162 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2163 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2165 DataArrayInt *arrOut=0,*arrIndexOut=0;
2168 std::vector<int> multiVal;
2169 std::pair<int, std::pair<int,int> > slic;
2170 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2172 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2173 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2178 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2183 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2188 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2192 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2194 PyObject *ret=PyTuple_New(2);
2195 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2196 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2200 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2201 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2205 std::vector<int> multiVal;
2206 std::pair<int, std::pair<int,int> > slic;
2207 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2209 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2210 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2215 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2220 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2225 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2229 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2233 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2237 DataArrayDoubleTuple *aa;
2238 std::vector<double> bb;
2240 int spaceDim=self->getSpaceDimension();
2241 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2242 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2244 std::vector<int> cells;
2245 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2246 DataArrayInt *ret=DataArrayInt::New();
2247 ret->alloc((int)cells.size(),1);
2248 std::copy(cells.begin(),cells.end(),ret->getPointer());
2249 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2252 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2256 DataArrayDoubleTuple *aa;
2257 std::vector<double> bb;
2259 int spaceDim=self->getSpaceDimension();
2260 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2261 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2262 self->orientCorrectly2DCells(v,polyOnly);
2265 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2267 std::vector<int> cells;
2268 self->arePolyhedronsNotCorrectlyOriented(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 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2279 self->getFastAveragePlaneOfThis(vec,pos);
2281 std::copy(vec,vec+3,vals);
2282 std::copy(pos,pos+3,vals+3);
2283 return convertDblArrToPyListOfTuple(vals,3,2);
2286 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2288 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2289 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2290 return MEDCouplingUMesh::MergeUMeshes(tmp);
2293 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2296 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2297 PyObject *ret=PyTuple_New(2);
2298 PyObject *ret0Py=ret0?Py_True:Py_False;
2300 PyTuple_SetItem(ret,0,ret0Py);
2301 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2305 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2308 bool ret0=self->areCellsIncludedIn2(other,ret1);
2309 PyObject *ret=PyTuple_New(2);
2310 PyObject *ret0Py=ret0?Py_True:Py_False;
2312 PyTuple_SetItem(ret,0,ret0Py);
2313 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2317 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2319 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2320 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2321 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2322 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2323 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2324 PyObject *ret=PyTuple_New(5);
2325 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2326 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2327 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2328 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2329 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2333 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2335 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2336 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2337 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2338 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2339 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2340 PyObject *ret=PyTuple_New(5);
2341 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2342 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2343 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2344 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2345 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2349 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2351 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2352 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2353 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2354 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2355 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2356 PyObject *ret=PyTuple_New(5);
2357 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2358 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2359 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2360 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2361 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2365 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2367 DataArrayInt *neighbors=0,*neighborsIdx=0;
2368 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2369 PyObject *ret=PyTuple_New(2);
2370 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2371 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2375 PyObject *computeNeighborsOfNodes() const throw(INTERP_KERNEL::Exception)
2377 DataArrayInt *neighbors=0,*neighborsIdx=0;
2378 self->computeNeighborsOfNodes(neighbors,neighborsIdx);
2379 PyObject *ret=PyTuple_New(2);
2380 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2381 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2385 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2387 DataArrayInt *neighbors=0,*neighborsIdx=0;
2388 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2389 PyObject *ret=PyTuple_New(2);
2390 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2391 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2395 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2397 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2398 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2399 DataArrayInt *d2,*d3,*d4,*dd5;
2400 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2401 PyObject *ret=PyTuple_New(7);
2402 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2403 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2404 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2405 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2406 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2407 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2408 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2412 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2415 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2416 da->checkAllocated();
2417 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2420 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2423 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2424 da->checkAllocated();
2425 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2428 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2431 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2432 da->checkAllocated();
2433 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2436 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2439 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2440 da->checkAllocated();
2441 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2442 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2443 PyObject *res = PyList_New(result.size());
2444 for (int i=0;iL!=result.end(); i++, iL++)
2445 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2449 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2452 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2453 da->checkAllocated();
2454 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2455 ret->setName(da->getName().c_str());
2459 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2461 DataArrayInt *cellNb1=0,*cellNb2=0;
2462 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2463 PyObject *ret=PyTuple_New(3);
2464 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2465 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2466 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2470 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2472 int spaceDim=self->getSpaceDimension();
2474 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2476 DataArrayDouble *a,*a2;
2477 DataArrayDoubleTuple *aa,*aa2;
2478 std::vector<double> bb,bb2;
2480 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2481 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2482 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2483 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2485 DataArrayInt *cellIds=0;
2486 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2487 PyObject *ret=PyTuple_New(2);
2488 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2489 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2493 PyObject *buildSlice3DSurf(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::buildSlice3DSurf : 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::buildSlice3DSurf : 1st paramater for origin.";
2504 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 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->buildSlice3DSurf(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 DataArrayInt *getCellIdsCrossingPlane(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::getCellIdsCrossingPlane : 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::getCellIdsCrossingPlane : 1st paramater for origin.";
2527 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 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);
2530 return self->getCellIdsCrossingPlane(orig,vect,eps);
2533 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2537 std::vector<int> pos2;
2538 DataArrayInt *pos3=0;
2539 DataArrayIntTuple *pos4=0;
2540 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2545 self->convertToPolyTypes(&pos1,&pos1+1);
2552 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2557 self->convertToPolyTypes(pos3->begin(),pos3->end());
2561 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2565 void convertAllToPoly();
2566 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2567 bool unPolyze() throw(INTERP_KERNEL::Exception);
2568 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2569 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2570 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2573 //== MEDCouplingUMesh End
2575 //== MEDCouplingExtrudedMesh
2577 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2580 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2581 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2583 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2585 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2588 std::string __str__() const throw(INTERP_KERNEL::Exception)
2590 return self->simpleRepr();
2593 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2595 std::ostringstream oss;
2596 self->reprQuickOverview(oss);
2600 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2602 MEDCouplingUMesh *ret=self->getMesh2D();
2605 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2607 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2609 MEDCouplingUMesh *ret=self->getMesh1D();
2612 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2614 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2616 DataArrayInt *ret=self->getMesh3DIds();
2619 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2624 //== MEDCouplingExtrudedMesh End
2626 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2629 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2630 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2631 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2632 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2633 virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2634 virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
2637 virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2639 int szArr,sw,iTypppArr;
2640 std::vector<int> stdvecTyyppArr;
2641 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2642 self->insertNextCell(tmp,tmp+szArr);
2645 virtual DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2647 DataArrayInt *ret=self->getNodalConnectivity();
2648 if(ret) ret->incrRef();
2652 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2654 std::vector< const MEDCoupling1GTUMesh *> parts;
2655 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
2656 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
2661 //== MEDCoupling1SGTUMesh
2663 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2666 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2667 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2668 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2669 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2670 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2671 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2672 MEDCoupling1GTUMesh *computeDualMesh() const throw(INTERP_KERNEL::Exception);
2673 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const throw(INTERP_KERNEL::Exception);
2674 DataArrayInt *sortHexa8EachOther() throw(INTERP_KERNEL::Exception);
2677 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2679 return MEDCoupling1SGTUMesh::New(name,type);
2682 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2684 return MEDCoupling1SGTUMesh::New(m);
2687 std::string __str__() const throw(INTERP_KERNEL::Exception)
2689 return self->simpleRepr();
2692 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2694 std::ostringstream oss;
2695 self->reprQuickOverview(oss);
2699 PyObject *structurizeMe(double eps=1e-12) const throw(INTERP_KERNEL::Exception)
2701 DataArrayInt *cellPerm(0),*nodePerm(0);
2702 MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps));
2703 PyObject *ret(PyTuple_New(3));
2704 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 ));
2705 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2706 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2710 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2712 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2713 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2714 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2717 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2719 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2720 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2721 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2726 //== MEDCoupling1SGTUMesh End
2728 //== MEDCoupling1DGTUMesh
2730 class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2733 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2734 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2735 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
2736 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2737 bool isPacked() const throw(INTERP_KERNEL::Exception);
2740 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2742 return MEDCoupling1DGTUMesh::New(name,type);
2745 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2747 return MEDCoupling1DGTUMesh::New(m);
2750 std::string __str__() const throw(INTERP_KERNEL::Exception)
2752 return self->simpleRepr();
2755 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2757 std::ostringstream oss;
2758 self->reprQuickOverview(oss);
2762 DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
2764 DataArrayInt *ret=self->getNodalConnectivityIndex();
2765 if(ret) ret->incrRef();
2769 PyObject *retrievePackedNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2771 DataArrayInt *ret1=0,*ret2=0;
2772 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
2773 PyObject *ret0Py=ret0?Py_True:Py_False;
2775 PyObject *ret=PyTuple_New(3);
2776 PyTuple_SetItem(ret,0,ret0Py);
2777 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2778 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2782 PyObject *copyWithNodalConnectivityPacked() const throw(INTERP_KERNEL::Exception)
2785 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
2786 PyObject *ret=PyTuple_New(2);
2787 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
2788 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
2789 PyTuple_SetItem(ret,1,ret1Py);
2793 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2795 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2796 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2797 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
2800 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2802 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2803 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2804 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
2807 static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt) throw(INTERP_KERNEL::Exception)
2809 std::vector<const ParaMEDMEM::DataArrayInt *> tmp;
2810 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2811 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
2816 //== MEDCoupling1DGTUMeshEnd
2818 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2821 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2822 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2823 int getNumberOfCellsOfSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2824 int getSpaceDimensionOnNodeStruct() const throw(INTERP_KERNEL::Exception);
2825 virtual std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2826 std::vector<int> getCellGridStructure() const throw(INTERP_KERNEL::Exception);
2827 MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception);
2828 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
2829 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2830 static int DeduceNumberOfGivenStructure(const std::vector<int>& st) throw(INTERP_KERNEL::Exception);
2831 static std::vector<int> GetSplitVectFromStruct(const std::vector<int>& strct) throw(INTERP_KERNEL::Exception);
2834 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const throw(INTERP_KERNEL::Exception)
2836 int tmpp1=-1,tmpp2=-1;
2837 std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
2838 std::vector< std::pair<int,int> > inp;
2842 for(int i=0;i<tmpp1;i++)
2843 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2848 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
2849 inp.resize(tmpp1/2);
2850 for(int i=0;i<tmpp1/2;i++)
2851 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2854 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
2855 return self->buildStructuredSubPart(inp);
2858 static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) throw(INTERP_KERNEL::Exception)
2860 std::vector< std::pair<int,int> > inp;
2861 convertPyToVectorPairInt(part,inp);
2863 int szArr,sw,iTypppArr;
2864 std::vector<int> stdvecTyyppArr;
2865 const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
2866 std::vector<int> tmp5(tmp4,tmp4+szArr);
2868 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
2871 static int DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part) throw(INTERP_KERNEL::Exception)
2873 std::vector< std::pair<int,int> > inp;
2874 convertPyToVectorPairInt(part,inp);
2875 return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp);
2878 static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) throw(INTERP_KERNEL::Exception)
2880 int szArr,sw,iTypppArr;
2881 std::vector<int> stdvecTyyppArr;
2882 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2883 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
2886 static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2888 int szArr,sw,iTypppArr;
2889 std::vector<int> stdvecTyyppArr;
2890 const int *tmp(convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr));
2891 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
2894 static std::vector<int> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat) throw(INTERP_KERNEL::Exception)
2896 std::vector< std::pair<int,int> > inp;
2897 convertPyToVectorPairInt(partCompactFormat,inp);
2898 return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp);
2901 static PyObject *IsPartStructured(PyObject *li, PyObject *st) throw(INTERP_KERNEL::Exception)
2903 int szArr,sw,iTypppArr;
2904 std::vector<int> stdvecTyyppArr;
2905 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2906 int szArr2,sw2,iTypppArr2;
2907 std::vector<int> stdvecTyyppArr2;
2908 const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
2909 std::vector<int> tmp3(tmp2,tmp2+szArr2);
2910 std::vector< std::pair<int,int> > partCompactFormat;
2911 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
2912 PyObject *ret=PyTuple_New(2);
2913 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
2914 PyTuple_SetItem(ret,0,ret0Py);
2915 PyObject *ret1Py=PyList_New(partCompactFormat.size());
2916 for(std::size_t i=0;i<partCompactFormat.size();i++)
2918 PyObject *tmp4=PyTuple_New(2);
2919 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
2920 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
2921 PyList_SetItem(ret1Py,i,tmp4);
2923 PyTuple_SetItem(ret,1,ret1Py);
2927 static PyObject *ChangeReferenceFromGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigInAbs) throw(INTERP_KERNEL::Exception)
2929 std::vector< std::pair<int,int> > param0,param1,ret;
2930 convertPyToVectorPairInt(bigInAbs,param0);
2931 convertPyToVectorPairInt(partOfBigInAbs,param1);
2932 MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(param0,param1,ret);
2933 PyObject *retPy(PyList_New(ret.size()));
2934 for(std::size_t i=0;i<ret.size();i++)
2936 PyObject *tmp(PyTuple_New(2));
2937 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
2938 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
2939 PyList_SetItem(retPy,i,tmp);
2944 static PyObject *ChangeReferenceToGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigRelativeToBig) throw(INTERP_KERNEL::Exception)
2946 std::vector< std::pair<int,int> > param0,param1,ret;
2947 convertPyToVectorPairInt(bigInAbs,param0);
2948 convertPyToVectorPairInt(partOfBigRelativeToBig,param1);
2949 MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(param0,param1,ret);
2950 PyObject *retPy(PyList_New(ret.size()));
2951 for(std::size_t i=0;i<ret.size();i++)
2953 PyObject *tmp(PyTuple_New(2));
2954 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
2955 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
2956 PyList_SetItem(retPy,i,tmp);
2963 //== MEDCouplingCMesh
2965 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2968 static MEDCouplingCMesh *New() throw(INTERP_KERNEL::Exception);
2969 static MEDCouplingCMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
2970 MEDCouplingCMesh *clone(bool recDeepCpy) const;
2971 void setCoords(const DataArrayDouble *coordsX,
2972 const DataArrayDouble *coordsY=0,
2973 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
2974 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
2976 MEDCouplingCMesh() throw(INTERP_KERNEL::Exception)
2978 return MEDCouplingCMesh::New();
2980 MEDCouplingCMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
2982 return MEDCouplingCMesh::New(meshName);
2984 std::string __str__() const throw(INTERP_KERNEL::Exception)
2986 return self->simpleRepr();
2988 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2990 std::ostringstream oss;
2991 self->reprQuickOverview(oss);
2994 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
2996 DataArrayDouble *ret=self->getCoordsAt(i);
3004 //== MEDCouplingCMesh End
3006 //== MEDCouplingCurveLinearMesh
3008 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3011 static MEDCouplingCurveLinearMesh *New() throw(INTERP_KERNEL::Exception);
3012 static MEDCouplingCurveLinearMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
3013 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
3014 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
3016 MEDCouplingCurveLinearMesh() throw(INTERP_KERNEL::Exception)
3018 return MEDCouplingCurveLinearMesh::New();
3020 MEDCouplingCurveLinearMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
3022 return MEDCouplingCurveLinearMesh::New(meshName);
3024 std::string __str__() const throw(INTERP_KERNEL::Exception)
3026 return self->simpleRepr();
3028 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3030 std::ostringstream oss;
3031 self->reprQuickOverview(oss);
3034 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
3036 DataArrayDouble *ret=self->getCoords();
3041 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
3043 int szArr,sw,iTypppArr;
3044 std::vector<int> stdvecTyyppArr;
3045 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
3046 self->setNodeGridStructure(tmp,tmp+szArr);
3051 //== MEDCouplingCurveLinearMesh End
3053 //== MEDCouplingIMesh
3055 class MEDCouplingIMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3058 static MEDCouplingIMesh *New() throw(INTERP_KERNEL::Exception);
3060 void setSpaceDimension(int spaceDim) throw(INTERP_KERNEL::Exception);
3061 std::vector<int> getNodeStruct() const throw(INTERP_KERNEL::Exception);
3062 std::vector<double> getOrigin() const throw(INTERP_KERNEL::Exception);
3063 std::vector<double> getDXYZ() const throw(INTERP_KERNEL::Exception);
3064 void setAxisUnit(const std::string& unitName) throw(INTERP_KERNEL::Exception);
3065 std::string getAxisUnit() const throw(INTERP_KERNEL::Exception);
3066 double getMeasureOfAnyCell() const throw(INTERP_KERNEL::Exception);
3067 MEDCouplingCMesh *convertToCartesian() const throw(INTERP_KERNEL::Exception);
3068 void refineWithFactor(const std::vector<int>& factors) throw(INTERP_KERNEL::Exception);
3069 MEDCouplingIMesh *asSingleCell() const throw(INTERP_KERNEL::Exception);
3070 MEDCouplingIMesh *buildWithGhost(int ghostLev) const throw(INTERP_KERNEL::Exception);
3075 return MEDCouplingIMesh::New();
3077 static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3079 static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
3080 static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
3081 const int *nodeStrctPtr(0);
3082 const double *originPtr(0),*dxyzPtr(0);
3084 std::vector<int> bb0;
3085 nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
3088 std::vector<double> bb,bb2;
3090 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
3091 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
3093 return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
3096 MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3098 return ParaMEDMEM_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
3101 void setNodeStruct(PyObject *nodeStrct) throw(INTERP_KERNEL::Exception)
3104 std::vector<int> bb0;
3105 const int *nodeStrctPtr(convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0));
3106 self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
3109 void setOrigin(PyObject *origin) throw(INTERP_KERNEL::Exception)
3111 static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3114 DataArrayDoubleTuple *aa;
3115 std::vector<double> bb;
3117 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
3118 self->setOrigin(originPtr,originPtr+nbTuples);
3121 void setDXYZ(PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3123 static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3126 DataArrayDoubleTuple *aa;
3127 std::vector<double> bb;
3129 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
3130 self->setDXYZ(originPtr,originPtr+nbTuples);
3133 static void CondenseFineToCoarse(const std::vector<int>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, DataArrayDouble *coarseDA) throw(INTERP_KERNEL::Exception)
3135 std::vector< std::pair<int,int> > inp;
3136 convertPyToVectorPairInt(fineLocInCoarse,inp);
3137 MEDCouplingIMesh::CondenseFineToCoarse(coarseSt,fineDA,inp,facts,coarseDA);
3140 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)
3142 std::vector< std::pair<int,int> > inp;
3143 convertPyToVectorPairInt(fineLocInCoarse,inp);
3144 MEDCouplingIMesh::CondenseFineToCoarseGhost(coarseSt,fineDA,inp,facts,coarseDA,ghostSize);
3147 static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts) throw(INTERP_KERNEL::Exception)
3149 std::vector< std::pair<int,int> > inp;
3150 convertPyToVectorPairInt(fineLocInCoarse,inp);
3151 MEDCouplingIMesh::SpreadCoarseToFine(coarseDA,coarseSt,fineDA,inp,facts);
3154 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)
3156 std::vector< std::pair<int,int> > inp;
3157 convertPyToVectorPairInt(fineLocInCoarse,inp);
3158 MEDCouplingIMesh::SpreadCoarseToFineGhost(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3161 std::string __str__() const throw(INTERP_KERNEL::Exception)
3163 return self->simpleRepr();
3165 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3167 std::ostringstream oss;
3168 self->reprQuickOverview(oss);
3174 //== MEDCouplingIMesh End
3178 namespace ParaMEDMEM
3180 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
3183 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
3184 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
3185 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3186 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3187 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
3188 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
3189 void setName(const char *name) throw(INTERP_KERNEL::Exception);
3190 std::string getDescription() const throw(INTERP_KERNEL::Exception);
3191 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
3192 std::string getName() const throw(INTERP_KERNEL::Exception);
3193 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
3194 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
3195 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
3196 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
3197 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
3198 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
3199 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
3200 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3201 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
3202 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
3203 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
3204 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
3205 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
3206 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
3207 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
3208 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3210 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
3212 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3215 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3218 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
3220 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3223 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3226 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
3228 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
3229 return convertIntArrToPyList3(ret);
3232 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
3235 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
3236 PyObject *ret=PyTuple_New(2);
3237 PyObject *ret0Py=ret0?Py_True:Py_False;
3239 PyTuple_SetItem(ret,0,ret0Py);
3240 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3244 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
3246 DataArrayInt *ret1=0;
3247 MEDCouplingMesh *ret0=0;
3249 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3250 if (!SWIG_IsOK(res1))
3253 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3254 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3258 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3260 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3261 da2->checkAllocated();
3262 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3264 PyObject *res = PyList_New(2);
3265 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3266 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3270 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
3272 DataArrayInt *ret1=0;
3274 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3275 PyObject *res=PyTuple_New(2);
3276 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3278 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3281 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3282 PyTuple_SetItem(res,1,res1);
3287 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3290 int v0; std::vector<int> v1;
3291 const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
3292 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3295 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3296 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3299 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3300 if (!SWIG_IsOK(res1))
3303 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3304 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3308 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3310 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3311 da2->checkAllocated();
3312 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3316 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3318 std::vector<int> tmp;
3319 self->getCellIdsHavingGaussLocalization(locId,tmp);
3320 DataArrayInt *ret=DataArrayInt::New();
3321 ret->alloc((int)tmp.size(),1);
3322 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3323 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3326 int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
3328 std::vector<int> inp0;
3329 convertPyToNewIntArr4(code,1,3,inp0);
3330 std::vector<const DataArrayInt *> inp1;
3331 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(idsPerType,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",inp1);
3332 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3337 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3340 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3341 static MEDCouplingFieldTemplate *New(TypeOfField type);
3342 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3343 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3346 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3348 return MEDCouplingFieldTemplate::New(f);
3351 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3353 return MEDCouplingFieldTemplate::New(type);
3356 std::string __str__() const throw(INTERP_KERNEL::Exception)
3358 return self->simpleRepr();
3361 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3363 std::ostringstream oss;
3364 self->reprQuickOverview(oss);
3370 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3373 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3374 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3375 void setTimeUnit(const std::string& unit);
3376 std::string getTimeUnit() const;
3377 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3378 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3379 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3380 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3381 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3382 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
3383 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3384 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3385 MEDCouplingFieldDouble *deepCpy() const;
3386 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3387 MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
3388 MEDCouplingFieldDouble *cellToNodeDiscretization() const throw(INTERP_KERNEL::Exception);
3389 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3390 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3391 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3392 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3393 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3394 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3395 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3396 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3397 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3398 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3399 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
3400 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3401 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3402 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3403 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3404 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3405 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3406 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3407 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3408 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3409 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3410 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3411 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3412 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3413 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3414 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3415 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3416 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3417 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3418 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3419 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3420 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3421 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3422 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3423 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3424 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3425 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3426 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3427 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3428 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3429 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3430 void fillFromAnalytic(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3431 void fillFromAnalytic2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3432 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3433 void applyFunc(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3434 void applyFunc2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3435 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3436 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3437 void applyFunc(const std::string& func) throw(INTERP_KERNEL::Exception);
3438 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
3439 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
3440 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3441 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3442 double getMinValue() const throw(INTERP_KERNEL::Exception);
3443 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3444 double norm2() const throw(INTERP_KERNEL::Exception);
3445 double normMax() const throw(INTERP_KERNEL::Exception);
3446 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3447 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3448 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3449 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3450 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3451 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3452 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3453 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3454 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3455 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3456 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3457 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3458 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3459 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3460 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3461 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3462 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3463 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3464 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3465 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3466 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3467 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3469 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3471 return MEDCouplingFieldDouble::New(type,td);
3474 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3476 return MEDCouplingFieldDouble::New(ft,td);
3479 std::string __str__() const throw(INTERP_KERNEL::Exception)
3481 return self->simpleRepr();
3484 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3486 std::ostringstream oss;
3487 self->reprQuickOverview(oss);
3491 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3493 DataArrayDouble *ret=self->getArray();
3499 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3501 std::vector<DataArrayDouble *> arrs=self->getArrays();
3502 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3506 PyObject *ret=PyTuple_New(sz);
3507 for(int i=0;i<sz;i++)
3510 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3512 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3517 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3519 std::vector<const DataArrayDouble *> tmp;
3520 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3522 std::vector<DataArrayDouble *> arrs(sz);
3523 for(int i=0;i<sz;i++)
3524 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3525 self->setArrays(arrs);
3528 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3530 DataArrayDouble *ret=self->getEndArray();
3536 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3540 DataArrayDoubleTuple *aa;
3541 std::vector<double> bb;
3543 const MEDCouplingMesh *mesh=self->getMesh();
3545 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3546 int spaceDim=mesh->getSpaceDimension();
3547 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3548 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3550 int sz=self->getNumberOfComponents();
3551 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3552 self->getValueOn(spaceLoc,res);
3553 return convertDblArrToPyList(res,sz);
3556 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3558 int sz=self->getNumberOfComponents();
3559 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3560 self->getValueOnPos(i,j,k,res);
3561 return convertDblArrToPyList(res,sz);
3564 DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
3566 const MEDCouplingMesh *mesh(self->getMesh());
3568 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3571 double v0; ParaMEDMEM::DataArrayDouble *v1(0); ParaMEDMEM::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
3572 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
3573 mesh->getSpaceDimension(),true,nbPts);
3574 return self->getValueOnMulti(inp,nbPts);
3577 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3581 DataArrayDoubleTuple *aa;
3582 std::vector<double> bb;
3584 const MEDCouplingMesh *mesh=self->getMesh();
3586 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3587 int spaceDim=mesh->getSpaceDimension();
3588 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3589 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3592 int sz=self->getNumberOfComponents();
3593 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3594 self->getValueOn(spaceLoc,time,res);
3595 return convertDblArrToPyList(res,sz);
3598 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3600 if(self->getArray()!=0)
3601 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3604 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3605 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3606 self->setArray(arr);
3610 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3613 double tmp0=self->getTime(tmp1,tmp2);
3614 PyObject *res = PyList_New(3);
3615 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3616 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3617 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3621 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3624 double tmp0=self->getStartTime(tmp1,tmp2);
3625 PyObject *res = PyList_New(3);
3626 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3627 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3628 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3632 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3635 double tmp0=self->getEndTime(tmp1,tmp2);
3636 PyObject *res = PyList_New(3);
3637 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3638 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3639 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3642 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3644 int sz=self->getNumberOfComponents();
3645 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3646 self->accumulate(tmp);
3647 return convertDblArrToPyList(tmp,sz);
3649 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3651 int sz=self->getNumberOfComponents();
3652 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3653 self->integral(isWAbs,tmp);
3654 return convertDblArrToPyList(tmp,sz);
3656 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3658 int sz=self->getNumberOfComponents();
3659 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3660 self->getWeightedAverageValue(tmp,isWAbs);
3661 return convertDblArrToPyList(tmp,sz);
3663 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3665 int sz=self->getNumberOfComponents();
3666 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3668 return convertDblArrToPyList(tmp,sz);
3670 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3672 int sz=self->getNumberOfComponents();
3673 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3675 return convertDblArrToPyList(tmp,sz);
3677 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3679 int szArr,sw,iTypppArr;
3680 std::vector<int> stdvecTyyppArr;
3681 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3682 self->renumberCells(tmp,check);
3685 void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3687 int szArr,sw,iTypppArr;
3688 std::vector<int> stdvecTyyppArr;
3689 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3690 self->renumberCellsWithoutMesh(tmp,check);
3693 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3695 int szArr,sw,iTypppArr;
3696 std::vector<int> stdvecTyyppArr;
3697 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3698 self->renumberNodes(tmp,eps);
3701 void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3703 int szArr,sw,iTypppArr;
3704 std::vector<int> stdvecTyyppArr;
3705 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3706 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
3709 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3713 std::vector<int> multiVal;
3714 std::pair<int, std::pair<int,int> > slic;
3715 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3716 const MEDCouplingMesh *mesh=self->getMesh();
3718 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3719 int nbc=mesh->getNumberOfCells();
3720 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3727 std::ostringstream oss;
3728 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3729 throw INTERP_KERNEL::Exception(oss.str().c_str());
3732 return self->buildSubPart(&singleVal,&singleVal+1);
3737 int tmp=nbc+singleVal;
3738 return self->buildSubPart(&tmp,&tmp+1);
3742 std::ostringstream oss;
3743 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3744 throw INTERP_KERNEL::Exception(oss.str().c_str());
3750 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3754 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3759 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3760 daIntTyypp->checkAllocated();
3761 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3764 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3768 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3770 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";
3771 if(PyTuple_Check(li))
3773 Py_ssize_t sz=PyTuple_Size(li);
3775 throw INTERP_KERNEL::Exception(msg);
3776 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3779 std::vector<int> multiVal;
3780 std::pair<int, std::pair<int,int> > slic;
3781 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3782 if(!self->getArray())
3783 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3785 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3786 catch(INTERP_KERNEL::Exception& e)
3787 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3788 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3789 DataArrayDouble *ret0Arr=ret0->getArray();
3791 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3796 std::vector<int> v2(1,singleVal);
3797 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3798 ret0->setArray(aarr);
3803 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3804 ret0->setArray(aarr);
3809 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3810 std::vector<int> v2(nbOfComp);
3811 for(int i=0;i<nbOfComp;i++)
3812 v2[i]=slic.first+i*slic.second.second;
3813 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3814 ret0->setArray(aarr);
3818 throw INTERP_KERNEL::Exception(msg);
3823 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3826 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3829 double r1=self->getMaxValue2(tmp);
3830 PyObject *ret=PyTuple_New(2);
3831 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3832 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3836 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3839 double r1=self->getMinValue2(tmp);
3840 PyObject *ret=PyTuple_New(2);
3841 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3842 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3846 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3848 std::vector<int> tmp;
3849 convertPyToNewIntArr3(li,tmp);
3850 return self->keepSelectedComponents(tmp);
3853 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3855 std::vector<int> tmp;
3856 convertPyToNewIntArr3(li,tmp);
3857 self->setSelectedComponents(f,tmp);
3860 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3863 DataArrayDouble *a,*a2;
3864 DataArrayDoubleTuple *aa,*aa2;
3865 std::vector<double> bb,bb2;
3868 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
3869 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
3870 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3871 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3873 return self->extractSlice3D(orig,vect,eps);
3876 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3878 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
3881 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3883 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
3886 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3888 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.";
3889 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
3892 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3894 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3896 return (*self)-(*other);
3898 throw INTERP_KERNEL::Exception(msg);
3903 DataArrayDoubleTuple *aa;
3904 std::vector<double> bb;
3906 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3911 if(!self->getArray())
3912 throw INTERP_KERNEL::Exception(msg2);
3913 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3914 ret->applyLin(1.,-val);
3915 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3916 ret2->setArray(ret);
3921 if(!self->getArray())
3922 throw INTERP_KERNEL::Exception(msg2);
3923 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
3924 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3925 ret2->setArray(ret);
3930 if(!self->getArray())
3931 throw INTERP_KERNEL::Exception(msg2);
3932 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3933 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3934 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3935 ret2->setArray(ret);
3940 if(!self->getArray())
3941 throw INTERP_KERNEL::Exception(msg2);
3942 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3943 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3944 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3945 ret2->setArray(ret);
3949 { throw INTERP_KERNEL::Exception(msg); }
3953 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3955 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
3958 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3960 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
3963 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3965 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
3968 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3970 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.";
3971 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
3974 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3976 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3978 return (*self)/(*other);
3980 throw INTERP_KERNEL::Exception(msg);
3985 DataArrayDoubleTuple *aa;
3986 std::vector<double> bb;
3988 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3994 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
3995 if(!self->getArray())
3996 throw INTERP_KERNEL::Exception(msg2);
3997 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3998 ret->applyLin(1./val,0);
3999 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4000 ret2->setArray(ret);
4005 if(!self->getArray())
4006 throw INTERP_KERNEL::Exception(msg2);
4007 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
4008 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4009 ret2->setArray(ret);
4014 if(!self->getArray())
4015 throw INTERP_KERNEL::Exception(msg2);
4016 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4017 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4018 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4019 ret2->setArray(ret);
4024 if(!self->getArray())
4025 throw INTERP_KERNEL::Exception(msg2);
4026 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4027 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4028 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4029 ret2->setArray(ret);
4033 { throw INTERP_KERNEL::Exception(msg); }
4037 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4039 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
4042 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4044 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.";
4045 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
4048 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4050 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4052 return (*self)^(*other);
4054 throw INTERP_KERNEL::Exception(msg);
4059 DataArrayDoubleTuple *aa;
4060 std::vector<double> bb;
4062 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4067 if(!self->getArray())
4068 throw INTERP_KERNEL::Exception(msg2);
4069 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
4071 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4072 ret2->setArray(ret);
4077 if(!self->getArray())
4078 throw INTERP_KERNEL::Exception(msg2);
4079 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
4080 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4081 ret2->setArray(ret);
4086 if(!self->getArray())
4087 throw INTERP_KERNEL::Exception(msg2);
4088 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4089 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4090 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4091 ret2->setArray(ret);
4096 if(!self->getArray())
4097 throw INTERP_KERNEL::Exception(msg2);
4098 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4099 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4100 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4101 ret2->setArray(ret);
4105 { throw INTERP_KERNEL::Exception(msg); }
4109 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
4111 return self->negate();
4114 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4116 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.";
4117 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
4120 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4122 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4126 Py_XINCREF(trueSelf);
4130 throw INTERP_KERNEL::Exception(msg);
4135 DataArrayDoubleTuple *aa;
4136 std::vector<double> bb;
4138 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4143 if(!self->getArray())
4144 throw INTERP_KERNEL::Exception(msg2);
4145 self->getArray()->applyLin(1.,val);
4146 Py_XINCREF(trueSelf);
4151 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4154 Py_XINCREF(trueSelf);
4159 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4160 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4161 ret2->setArray(aaa);
4163 Py_XINCREF(trueSelf);
4168 if(!self->getArray())
4169 throw INTERP_KERNEL::Exception(msg2);
4170 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4171 self->getArray()->addEqual(aaa);
4172 Py_XINCREF(trueSelf);
4176 { throw INTERP_KERNEL::Exception(msg); }
4180 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4182 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.";
4183 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4186 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4188 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4192 Py_XINCREF(trueSelf);
4196 throw INTERP_KERNEL::Exception(msg);
4201 DataArrayDoubleTuple *aa;
4202 std::vector<double> bb;
4204 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4209 if(!self->getArray())
4210 throw INTERP_KERNEL::Exception(msg2);
4211 self->getArray()->applyLin(1.,-val);
4212 Py_XINCREF(trueSelf);
4217 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4220 Py_XINCREF(trueSelf);
4225 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4226 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4227 ret2->setArray(aaa);
4229 Py_XINCREF(trueSelf);
4234 if(!self->getArray())
4235 throw INTERP_KERNEL::Exception(msg2);
4236 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4237 self->getArray()->substractEqual(aaa);
4238 Py_XINCREF(trueSelf);
4242 { throw INTERP_KERNEL::Exception(msg); }
4246 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4248 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.";
4249 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4252 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4254 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4258 Py_XINCREF(trueSelf);
4262 throw INTERP_KERNEL::Exception(msg);
4267 DataArrayDoubleTuple *aa;
4268 std::vector<double> bb;
4270 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4275 if(!self->getArray())
4276 throw INTERP_KERNEL::Exception(msg2);
4277 self->getArray()->applyLin(val,0);
4278 Py_XINCREF(trueSelf);
4283 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4286 Py_XINCREF(trueSelf);
4291 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4292 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4293 ret2->setArray(aaa);
4295 Py_XINCREF(trueSelf);
4300 if(!self->getArray())
4301 throw INTERP_KERNEL::Exception(msg2);
4302 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4303 self->getArray()->multiplyEqual(aaa);
4304 Py_XINCREF(trueSelf);
4308 { throw INTERP_KERNEL::Exception(msg); }
4312 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4314 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.";
4315 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4318 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4320 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4324 Py_XINCREF(trueSelf);
4328 throw INTERP_KERNEL::Exception(msg);
4333 DataArrayDoubleTuple *aa;
4334 std::vector<double> bb;
4336 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4342 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4343 if(!self->getArray())
4344 throw INTERP_KERNEL::Exception(msg2);
4345 self->getArray()->applyLin(1./val,0);
4346 Py_XINCREF(trueSelf);
4351 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4354 Py_XINCREF(trueSelf);
4359 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4360 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4361 ret2->setArray(aaa);
4363 Py_XINCREF(trueSelf);
4368 if(!self->getArray())
4369 throw INTERP_KERNEL::Exception(msg2);
4370 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4371 self->getArray()->divideEqual(aaa);
4372 Py_XINCREF(trueSelf);
4376 { throw INTERP_KERNEL::Exception(msg); }
4380 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4382 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.";
4383 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4386 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4388 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4392 Py_XINCREF(trueSelf);
4396 throw INTERP_KERNEL::Exception(msg);
4401 DataArrayDoubleTuple *aa;
4402 std::vector<double> bb;
4404 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4409 if(!self->getArray())
4410 throw INTERP_KERNEL::Exception(msg2);
4411 self->getArray()->applyPow(val);
4412 Py_XINCREF(trueSelf);
4417 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4420 Py_XINCREF(trueSelf);
4425 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4426 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4427 ret2->setArray(aaa);
4429 Py_XINCREF(trueSelf);
4434 if(!self->getArray())
4435 throw INTERP_KERNEL::Exception(msg2);
4436 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4437 self->getArray()->powEqual(aaa);
4438 Py_XINCREF(trueSelf);
4442 { throw INTERP_KERNEL::Exception(msg); }
4446 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4448 std::vector<const MEDCouplingFieldDouble *> tmp;
4449 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4450 return MEDCouplingFieldDouble::MergeFields(tmp);
4453 static void WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
4455 std::vector<const MEDCouplingFieldDouble *> tmp;
4456 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4457 MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4462 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4465 int getNumberOfFields() const;
4466 MEDCouplingMultiFields *deepCpy() const;
4467 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4468 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4469 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4470 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4471 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4474 std::string __str__() const throw(INTERP_KERNEL::Exception)
4476 return self->simpleRepr();
4478 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4480 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4481 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4483 std::vector<MEDCouplingFieldDouble *> fs(sz);
4484 for(int i=0;i<sz;i++)
4485 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4486 return MEDCouplingMultiFields::New(fs);
4488 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4490 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4491 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4493 std::vector<MEDCouplingFieldDouble *> fs(sz);
4494 for(int i=0;i<sz;i++)
4495 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4496 return MEDCouplingMultiFields::New(fs);
4498 PyObject *getFields() const
4500 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4501 int sz=fields.size();
4502 PyObject *res = PyList_New(sz);
4503 for(int i=0;i<sz;i++)
4507 fields[i]->incrRef();
4508 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4512 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4517 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4519 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4523 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4526 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4528 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4530 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4532 PyObject *res = PyList_New(sz);
4533 for(int i=0;i<sz;i++)
4538 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4542 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4547 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4549 std::vector<int> refs;
4550 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4552 PyObject *res = PyList_New(sz);
4553 for(int i=0;i<sz;i++)
4558 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4562 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4566 PyObject *ret=PyTuple_New(2);
4567 PyTuple_SetItem(ret,0,res);
4568 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4571 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4573 std::vector<DataArrayDouble *> ms=self->getArrays();
4575 PyObject *res = PyList_New(sz);
4576 for(int i=0;i<sz;i++)
4581 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4585 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4590 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4592 std::vector< std::vector<int> > refs;
4593 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4595 PyObject *res = PyList_New(sz);
4596 PyObject *res2 = PyList_New(sz);
4597 for(int i=0;i<sz;i++)
4602 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4606 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4608 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4611 PyObject *ret=PyTuple_New(2);
4612 PyTuple_SetItem(ret,0,res);
4613 PyTuple_SetItem(ret,1,res2);
4619 class MEDCouplingDefinitionTime
4622 MEDCouplingDefinitionTime();
4623 void assign(const MEDCouplingDefinitionTime& other);
4624 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4625 double getTimeResolution() const;
4626 std::vector<double> getHotSpotsTime() const;
4629 std::string __str__() const throw(INTERP_KERNEL::Exception)
4631 std::ostringstream oss;
4632 self->appendRepr(oss);
4636 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4638 int meshId,arrId,arrIdInField,fieldId;
4639 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4640 PyObject *res=PyList_New(4);
4641 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4642 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4643 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4644 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4648 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4650 int meshId,arrId,arrIdInField,fieldId;
4651 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4652 PyObject *res=PyList_New(4);
4653 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4654 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4655 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4656 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4662 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4665 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4666 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4670 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4672 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4673 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4675 std::vector<MEDCouplingFieldDouble *> fs(sz);
4676 for(int i=0;i<sz;i++)
4677 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4678 return MEDCouplingFieldOverTime::New(fs);
4680 std::string __str__() const throw(INTERP_KERNEL::Exception)
4682 return self->simpleRepr();
4684 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4686 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4687 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4689 std::vector<MEDCouplingFieldDouble *> fs(sz);
4690 for(int i=0;i<sz;i++)
4691 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4692 return MEDCouplingFieldOverTime::New(fs);
4697 class MEDCouplingCartesianAMRMesh;
4699 class MEDCouplingCartesianAMRPatch : public RefCountObject
4702 int getNumberOfCellsRecursiveWithOverlap() const throw(INTERP_KERNEL::Exception);
4703 int getNumberOfCellsRecursiveWithoutOverlap() const throw(INTERP_KERNEL::Exception);
4704 int getMaxNumberOfLevelsRelativeToThis() const throw(INTERP_KERNEL::Exception);
4705 int getNumberOfOverlapedCellsForFather() const throw(INTERP_KERNEL::Exception);
4708 PyObject *getBLTRRange() const throw(INTERP_KERNEL::Exception)
4710 const std::vector< std::pair<int,int> >& ret(self->getBLTRRange());
4711 return convertFromVectorPairInt(ret);
4714 MEDCouplingCartesianAMRMesh *getMesh() const throw(INTERP_KERNEL::Exception)
4716 MEDCouplingCartesianAMRMesh *ret(const_cast<MEDCouplingCartesianAMRMesh *>(self->getMesh()));
4722 void addPatch(PyObject *bottomLeftTopRight, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception)
4724 std::vector< std::pair<int,int> > inp;
4725 convertPyToVectorPairInt(bottomLeftTopRight,inp);
4726 self->addPatch(inp,factors);
4729 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const throw(INTERP_KERNEL::Exception)
4731 const MEDCouplingCartesianAMRMesh *mesh(self->getMesh());
4733 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__getitem__ : no underlying mesh !");
4734 if(patchId==mesh->getNumberOfPatches())
4736 std::ostringstream oss;
4737 oss << "Requesting for patchId " << patchId << " having only " << mesh->getNumberOfPatches() << " patches !";
4738 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4741 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(mesh->getPatch(patchId)));
4747 void __delitem__(int patchId) throw(INTERP_KERNEL::Exception)
4749 MEDCouplingCartesianAMRMesh *mesh(const_cast<MEDCouplingCartesianAMRMesh *>(self->getMesh()));
4751 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__delitem__ : no underlying mesh !");
4752 mesh->removePatch(patchId);
4755 int __len__() const throw(INTERP_KERNEL::Exception)
4757 const MEDCouplingCartesianAMRMesh *mesh(self->getMesh());
4759 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__len__ : no underlying mesh !");
4760 return mesh->getNumberOfPatches();
4765 class MEDCouplingCartesianAMRMesh : public RefCountObject, public TimeLabel
4769 int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
4770 const std::vector<int>& getFactors() const throw(INTERP_KERNEL::Exception);
4771 void setFactors(const std::vector<int>& newFactors) throw(INTERP_KERNEL::Exception);
4772 int getMaxNumberOfLevelsRelativeToThis() const throw(INTERP_KERNEL::Exception);
4773 int getNumberOfCellsAtCurrentLevel() const throw(INTERP_KERNEL::Exception);
4774 int getNumberOfCellsRecursiveWithOverlap() const throw(INTERP_KERNEL::Exception);
4775 int getNumberOfCellsRecursiveWithoutOverlap() const throw(INTERP_KERNEL::Exception);
4777 int getNumberOfPatches() const throw(INTERP_KERNEL::Exception);
4778 MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
4779 MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const throw(INTERP_KERNEL::Exception);
4780 void removeAllPatches() throw(INTERP_KERNEL::Exception);
4781 void removePatch(int patchId) throw(INTERP_KERNEL::Exception);
4782 void detachFromFather() throw(INTERP_KERNEL::Exception);
4783 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception);
4784 DataArrayDouble *createCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis) const throw(INTERP_KERNEL::Exception);
4785 void fillCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch) const throw(INTERP_KERNEL::Exception);
4786 void fillCellFieldComingFromPatch(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis) const throw(INTERP_KERNEL::Exception);
4789 static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
4791 static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !";
4792 static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !";
4793 const int *nodeStrctPtr(0);
4794 const double *originPtr(0),*dxyzPtr(0);
4796 std::vector<int> bb0;
4797 nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
4800 std::vector<double> bb,bb2;
4802 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
4803 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
4805 return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
4808 MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
4810 return ParaMEDMEM_MEDCouplingCartesianAMRMesh_New(meshName,spaceDim,nodeStrct,origin,dxyz);
4813 void addPatch(PyObject *bottomLeftTopRight, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception)
4815 std::vector< std::pair<int,int> > inp;
4816 convertPyToVectorPairInt(bottomLeftTopRight,inp);
4817 self->addPatch(inp,factors);
4820 MEDCouplingCartesianAMRMesh *getFather() const throw(INTERP_KERNEL::Exception)
4822 MEDCouplingCartesianAMRMesh *ret(const_cast<MEDCouplingCartesianAMRMesh *>(self->getFather()));
4828 MEDCouplingCartesianAMRMesh *getGodFather() const throw(INTERP_KERNEL::Exception)
4830 MEDCouplingCartesianAMRMesh *ret(const_cast<MEDCouplingCartesianAMRMesh *>(self->getGodFather()));
4836 MEDCouplingCartesianAMRPatch *getPatch(int patchId) const throw(INTERP_KERNEL::Exception)
4838 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
4844 MEDCouplingIMesh *getImageMesh() const throw(INTERP_KERNEL::Exception)
4846 const MEDCouplingIMesh *ret(self->getImageMesh());
4849 return const_cast<MEDCouplingIMesh *>(ret);
4852 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const throw(INTERP_KERNEL::Exception)
4854 if(patchId==self->getNumberOfPatches())
4856 std::ostringstream oss;
4857 oss << "Requesting for patchId " << patchId << " having only " << self->getNumberOfPatches() << " patches !";
4858 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4861 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
4867 void __delitem__(int patchId) throw(INTERP_KERNEL::Exception)
4869 self->removePatch(patchId);
4872 int __len__() const throw(INTERP_KERNEL::Exception)
4874 return self->getNumberOfPatches();
4879 class DenseMatrix : public RefCountObject, public TimeLabel
4882 static DenseMatrix *New(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
4883 static DenseMatrix *New(DataArrayDouble *array, int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
4884 DenseMatrix *deepCpy() const throw(INTERP_KERNEL::Exception);
4885 DenseMatrix *shallowCpy() const throw(INTERP_KERNEL::Exception);
4887 int getNumberOfRows() const throw(INTERP_KERNEL::Exception);
4888 int getNumberOfCols() const throw(INTERP_KERNEL::Exception);
4889 int getNbOfElems() const throw(INTERP_KERNEL::Exception);
4890 void reBuild(DataArrayDouble *array, int nbRows=-1, int nbCols=-1) throw(INTERP_KERNEL::Exception);
4891 void reShape(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
4892 void transpose() throw(INTERP_KERNEL::Exception);
4894 bool isEqual(const DenseMatrix& other, double eps) const throw(INTERP_KERNEL::Exception);
4895 DataArrayDouble *matVecMult(const DataArrayDouble *vec) const throw(INTERP_KERNEL::Exception);
4896 static DataArrayDouble *MatVecMult(const DenseMatrix *mat, const DataArrayDouble *vec) throw(INTERP_KERNEL::Exception);
4899 DenseMatrix(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception)
4901 return DenseMatrix::New(nbRows,nbCols);
4904 DenseMatrix(DataArrayDouble *array, int nbRows, int nbCols) throw(INTERP_KERNEL::Exception)
4906 return DenseMatrix::New(array,nbRows,nbCols);
4909 PyObject *isEqualIfNotWhy(const DenseMatrix& other, double eps) const throw(INTERP_KERNEL::Exception)
4912 bool ret0=self->isEqualIfNotWhy(other,eps,ret1);
4913 PyObject *ret=PyTuple_New(2);
4914 PyObject *ret0Py=ret0?Py_True:Py_False;
4916 PyTuple_SetItem(ret,0,ret0Py);
4917 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4921 DataArrayDouble *getData() throw(INTERP_KERNEL::Exception)
4923 DataArrayDouble *ret(self->getData());
4929 DenseMatrix *__add__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
4931 return ParaMEDMEM::DenseMatrix::Add(self,other);
4934 DenseMatrix *__sub__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
4936 return ParaMEDMEM::DenseMatrix::Substract(self,other);
4939 DenseMatrix *__mul__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
4941 return ParaMEDMEM::DenseMatrix::Multiply(self,other);
4944 DenseMatrix *__mul__(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception)
4946 return ParaMEDMEM::DenseMatrix::Multiply(self,other);
4949 PyObject *___iadd___(PyObject *trueSelf, const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
4951 self->addEqual(other);
4952 Py_XINCREF(trueSelf);
4956 PyObject *___isub___(PyObject *trueSelf, const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
4958 self->substractEqual(other);
4959 Py_XINCREF(trueSelf);
4963 PyObject *toNumPyMatrix() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
4965 PyObject *obj(ToNumPyArrayUnderground<DataArrayDouble,double>(self->getData(),NPY_DOUBLE,"DataArrayDouble",self->getNumberOfRows(),self->getNumberOfCols()));
4975 __filename=os.environ.get('PYTHONSTARTUP')
4976 if __filename and os.path.isfile(__filename):
4977 execfile(__filename)