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"
49 using namespace ParaMEDMEM;
50 using namespace INTERP_KERNEL;
54 %template(ivec) std::vector<int>;
55 %template(dvec) std::vector<double>;
56 %template(svec) std::vector<std::string>;
59 %typemap(out) ParaMEDMEM::MEDCouplingMesh*
61 $result=convertMesh($1,$owner);
64 %typemap(out) MEDCouplingMesh*
66 $result=convertMesh($1,$owner);
71 %typemap(out) ParaMEDMEM::MEDCouplingPointSet*
73 $result=convertMesh($1,$owner);
76 %typemap(out) MEDCouplingPointSet*
78 $result=convertMesh($1,$owner);
84 %typemap(out) ParaMEDMEM::MEDCoupling1GTUMesh*
86 $result=convertMesh($1,$owner);
89 %typemap(out) MEDCoupling1GTUMesh*
91 $result=convertMesh($1,$owner);
96 %typemap(out) ParaMEDMEM::MEDCouplingStructuredMesh*
98 $result=convertMesh($1,$owner);
101 %typemap(out) MEDCouplingStructuredMesh*
103 $result=convertMesh($1,$owner);
108 %typemap(out) ParaMEDMEM::MEDCouplingFieldDiscretization*
110 $result=convertFieldDiscretization($1,$owner);
113 %typemap(out) MEDCouplingFieldDiscretization*
115 $result=convertFieldDiscretization($1,$owner);
120 %typemap(out) ParaMEDMEM::MEDCouplingMultiFields*
122 $result=convertMultiFields($1,$owner);
125 %typemap(out) MEDCouplingMultiFields*
127 $result=convertMultiFields($1,$owner);
132 %init %{ import_array(); %}
135 %feature("autodoc", "1");
136 %feature("docstring");
138 %newobject ParaMEDMEM::MEDCouplingField::buildMeasureField;
139 %newobject ParaMEDMEM::MEDCouplingField::getLocalizationOfDiscr;
140 %newobject ParaMEDMEM::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
141 %newobject ParaMEDMEM::MEDCouplingFieldDouble::New;
142 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getArray;
143 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getEndArray;
144 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MergeFields;
145 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MeldFields;
146 %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct;
147 %newobject ParaMEDMEM::MEDCouplingFieldDouble::determinant;
148 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenValues;
149 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenVectors;
150 %newobject ParaMEDMEM::MEDCouplingFieldDouble::inverse;
151 %newobject ParaMEDMEM::MEDCouplingFieldDouble::trace;
152 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deviator;
153 %newobject ParaMEDMEM::MEDCouplingFieldDouble::magnitude;
154 %newobject ParaMEDMEM::MEDCouplingFieldDouble::maxPerTuple;
155 %newobject ParaMEDMEM::MEDCouplingFieldDouble::keepSelectedComponents;
156 %newobject ParaMEDMEM::MEDCouplingFieldDouble::extractSlice3D;
157 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DotFields;
158 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dot;
159 %newobject ParaMEDMEM::MEDCouplingFieldDouble::CrossProductFields;
160 %newobject ParaMEDMEM::MEDCouplingFieldDouble::crossProduct;
161 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MaxFields;
162 %newobject ParaMEDMEM::MEDCouplingFieldDouble::max;
163 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MinFields;
164 %newobject ParaMEDMEM::MEDCouplingFieldDouble::AddFields;
165 %newobject ParaMEDMEM::MEDCouplingFieldDouble::SubstractFields;
166 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MultiplyFields;
167 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DivideFields;
168 %newobject ParaMEDMEM::MEDCouplingFieldDouble::min;
169 %newobject ParaMEDMEM::MEDCouplingFieldDouble::negate;
170 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getIdsInRange;
171 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart;
172 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPartRange;
173 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__getitem__;
174 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__neg__;
175 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__add__;
176 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__sub__;
177 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__mul__;
178 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__div__;
179 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__pow__;
180 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__radd__;
181 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rsub__;
182 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rmul__;
183 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rdiv__;
184 %newobject ParaMEDMEM::MEDCouplingFieldDouble::clone;
185 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cloneWithMesh;
186 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy;
187 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
188 %newobject ParaMEDMEM::MEDCouplingFieldDouble::nodeToCellDiscretization;
189 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cellToNodeDiscretization;
190 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
191 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
192 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
193 %newobject ParaMEDMEM::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
194 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
195 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfNodesPerCell;
196 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfFacesPerCell;
197 %newobject ParaMEDMEM::MEDCouplingMesh::computeEffectiveNbOfNodesPerCell;
198 %newobject ParaMEDMEM::MEDCouplingMesh::buildPartRange;
199 %newobject ParaMEDMEM::MEDCouplingMesh::giveCellsWithType;
200 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
201 %newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
202 %newobject ParaMEDMEM::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
203 %newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
204 %newobject ParaMEDMEM::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
205 %newobject ParaMEDMEM::MEDCouplingMesh::mergeMyselfWith;
206 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic;
207 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic2;
208 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic3;
209 %newobject ParaMEDMEM::MEDCouplingMesh::getMeasureField;
210 %newobject ParaMEDMEM::MEDCouplingMesh::simplexize;
211 %newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured;
212 %newobject ParaMEDMEM::MEDCouplingMesh::MergeMeshes;
213 %newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer;
214 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellsInBoundingBox;
215 %newobject ParaMEDMEM::MEDCouplingPointSet::findBoundaryNodes;
216 %newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh;
217 %newobject ParaMEDMEM::MEDCouplingPointSet::MergeNodesArray;
218 %newobject ParaMEDMEM::MEDCouplingPointSet::buildPartOfMySelf2;
219 %newobject ParaMEDMEM::MEDCouplingPointSet::BuildInstanceFromMeshType;
220 %newobject ParaMEDMEM::MEDCouplingPointSet::zipConnectivityTraducer;
221 %newobject ParaMEDMEM::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
222 %newobject ParaMEDMEM::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
223 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellIdsLyingOnNodes;
224 %newobject ParaMEDMEM::MEDCouplingPointSet::deepCpyConnectivityOnly;
225 %newobject ParaMEDMEM::MEDCouplingPointSet::getBoundingBoxForBBTree;
226 %newobject ParaMEDMEM::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells;
227 %newobject ParaMEDMEM::MEDCouplingPointSet::__getitem__;
228 %newobject ParaMEDMEM::MEDCouplingUMesh::New;
229 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
230 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
231 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
232 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
233 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
234 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
235 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
236 %newobject ParaMEDMEM::MEDCouplingUMesh::explode3DMeshTo1D;
237 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
238 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
239 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
240 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
241 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
242 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
243 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
244 %newobject ParaMEDMEM::MEDCouplingUMesh::conformize2D;
245 %newobject ParaMEDMEM::MEDCouplingUMesh::colinearize2D;
246 %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
247 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
248 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
249 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
250 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
251 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
252 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
253 %newobject ParaMEDMEM::MEDCouplingUMesh::convertLinearCellsToQuadratic;
254 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
255 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
256 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
257 %newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField;
258 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner;
259 %newobject ParaMEDMEM::MEDCouplingUMesh::computePlaneEquationOf3DFaces;
260 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField;
261 %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
262 %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
263 %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
264 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
265 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
266 %newobject ParaMEDMEM::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
267 %newobject ParaMEDMEM::MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh;
268 %newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
269 %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
270 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis;
271 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsCrossingPlane;
272 %newobject ParaMEDMEM::MEDCouplingUMesh::convexEnvelop2D;
273 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
274 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf2DMesh;
275 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf3DMesh;
276 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
277 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
278 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic;
279 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
280 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
281 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::New;
282 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::getNodalConnectivity;
283 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
284 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::New;
285 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
286 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::computeDualMesh;
287 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
288 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::sortHexa8EachOther;
289 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
290 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
291 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::New;
292 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
293 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
294 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
295 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
296 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
297 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
298 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::buildStructuredSubPart;
299 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTUnstructured;
300 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTSubLevelMesh;
301 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
302 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
303 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh;
304 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
305 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
306 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
307 %newobject ParaMEDMEM::MEDCouplingIMesh::New;
308 %newobject ParaMEDMEM::MEDCouplingIMesh::convertToCartesian;
309 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
310 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
311 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
312 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
313 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
314 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
315 %newobject ParaMEDMEM::MEDCouplingCartesianAMRPatch::getMesh;
316 %newobject ParaMEDMEM::MEDCouplingCartesianAMRPatch::__getitem__;
317 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::New;
318 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::buildUnstructured;
319 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getGodFather;
320 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getFather;
321 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getPatch;
322 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::__getitem__;
323 %newobject ParaMEDMEM::DenseMatrix::New;
324 %newobject ParaMEDMEM::DenseMatrix::deepCpy;
325 %newobject ParaMEDMEM::DenseMatrix::shallowCpy;
326 %newobject ParaMEDMEM::DenseMatrix::getData;
327 %newobject ParaMEDMEM::DenseMatrix::matVecMult;
328 %newobject ParaMEDMEM::DenseMatrix::MatVecMult;
329 %newobject ParaMEDMEM::DenseMatrix::__add__;
330 %newobject ParaMEDMEM::DenseMatrix::__sub__;
331 %newobject ParaMEDMEM::DenseMatrix::__mul__;
333 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
334 %feature("unref") MEDCouplingMesh "$this->decrRef();"
335 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
336 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
337 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
338 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
339 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
340 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
341 %feature("unref") MEDCouplingIMesh "$this->decrRef();"
342 %feature("unref") MEDCouplingCurveLinearMesh "$this->decrRef();"
343 %feature("unref") MEDCouplingField "$this->decrRef();"
344 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
345 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
346 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
347 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
348 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
349 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
350 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
351 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
352 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
353 %feature("unref") MEDCouplingCartesianAMRMesh "$this->decrRef();"
354 %feature("unref") MEDCouplingCartesianAMRPatch "$this->decrRef();"
355 %feature("unref") DenseMatrix "$this->decrRef();"
357 %rename(assign) *::operator=;
358 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
359 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
360 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
361 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
365 %rename (InterpKernelException) INTERP_KERNEL::Exception;
367 %include "MEDCouplingRefCountObject.i"
368 %include "MEDCouplingMemArray.i"
386 CONST_ON_TIME_INTERVAL = 7
387 } TypeOfTimeDiscretization;
395 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
396 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
398 } MEDCouplingMeshType;
401 class DataArrayDouble;
402 class MEDCouplingUMesh;
403 class MEDCouplingFieldDouble;
405 %extend RefCountObject
407 std::string getHiddenCppPointer() const
409 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
414 %extend MEDCouplingGaussLocalization
416 std::string __str__() const throw(INTERP_KERNEL::Exception)
418 return self->getStringRepr();
421 std::string __repr__() const throw(INTERP_KERNEL::Exception)
423 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
424 oss << self->getStringRepr();
431 class MEDCouplingMesh : public RefCountObject, public TimeLabel
434 void setName(const std::string& name);
435 std::string getName() const;
436 void setDescription(const std::string& descr);
437 std::string getDescription() const;
438 void setTime(double val, int iteration, int order);
439 void setTimeUnit(const std::string& unit);
440 std::string getTimeUnit() const;
441 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
442 bool isStructured() const throw(INTERP_KERNEL::Exception);
443 virtual MEDCouplingMesh *deepCpy() const;
444 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
445 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
446 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
447 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
448 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
449 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
450 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
451 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
452 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
453 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
454 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
455 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
456 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
457 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
458 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
459 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
460 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
461 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
462 virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
463 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
464 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
465 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
466 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
467 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
468 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
470 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
471 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
472 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
473 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
474 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception);
475 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
476 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
477 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
478 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
479 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
480 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
481 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
482 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
483 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
484 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
485 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
486 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
489 std::string __str__() const throw(INTERP_KERNEL::Exception)
491 return self->simpleRepr();
494 PyObject *getTime() throw(INTERP_KERNEL::Exception)
497 double tmp0=self->getTime(tmp1,tmp2);
498 PyObject *res = PyList_New(3);
499 PyList_SetItem(res,0,SWIG_From_double(tmp0));
500 PyList_SetItem(res,1,SWIG_From_int(tmp1));
501 PyList_SetItem(res,2,SWIG_From_int(tmp2));
505 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
509 DataArrayDoubleTuple *aa;
510 std::vector<double> bb;
512 int spaceDim=self->getSpaceDimension();
513 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
514 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
515 return self->getCellContainingPoint(pos,eps);
518 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
522 DataArrayDoubleTuple *aa;
523 std::vector<double> bb;
525 int spaceDim=self->getSpaceDimension();
526 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
527 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
528 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
529 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
530 PyObject *ret=PyTuple_New(2);
531 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
532 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
536 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
538 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
539 int spaceDim=self->getSpaceDimension();
541 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
542 if (!SWIG_IsOK(res1))
545 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
546 int nbOfPoints=size/spaceDim;
549 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
551 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
555 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
557 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
558 da2->checkAllocated();
559 int size=da2->getNumberOfTuples();
560 int nbOfCompo=da2->getNumberOfComponents();
561 if(nbOfCompo!=spaceDim)
563 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
565 self->getCellsContainingPoints(da2->getConstPointer(),size,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 *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
577 DataArrayDoubleTuple *aa;
578 std::vector<double> bb;
580 int spaceDim=self->getSpaceDimension();
581 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
582 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
583 std::vector<int> elts;
584 self->getCellsContainingPoint(pos,eps,elts);
585 DataArrayInt *ret=DataArrayInt::New();
586 ret->alloc((int)elts.size(),1);
587 std::copy(elts.begin(),elts.end(),ret->getPointer());
588 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
591 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
593 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
594 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
595 self->getReverseNodalConnectivity(d0,d1);
596 PyObject *ret=PyTuple_New(2);
597 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
598 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
602 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
605 int v0; std::vector<int> v1;
606 const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
607 self->renumberCells(ids,check);
610 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
612 DataArrayInt *cellCor, *nodeCor;
613 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
614 PyObject *res = PyList_New(2);
615 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
616 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
620 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
622 DataArrayInt *cellCor=0,*nodeCor=0;
623 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
624 PyObject *res = PyList_New(2);
625 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
626 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
630 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
632 DataArrayInt *cellCor=0;
633 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
637 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
640 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
641 if (!SWIG_IsOK(res1))
644 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
645 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
649 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
651 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
652 da2->checkAllocated();
653 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
656 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
658 std::vector<int> conn;
659 self->getNodeIdsOfCell(cellId,conn);
660 return convertIntArrToPyList2(conn);
663 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
665 std::vector<double> coo;
666 self->getCoordinatesOfNode(nodeId,coo);
667 return convertDblArrToPyList2(coo);
670 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
674 DataArrayDoubleTuple *aa;
675 std::vector<double> bb;
677 int spaceDim=self->getSpaceDimension();
678 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
679 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
680 self->scale(pointPtr,factor);
683 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
685 int spaceDim=self->getSpaceDimension();
686 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
687 self->getBoundingBox(tmp);
688 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
692 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
695 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
696 PyObject *ret=PyTuple_New(2);
697 PyObject *ret0Py=ret0?Py_True:Py_False;
699 PyTuple_SetItem(ret,0,ret0Py);
700 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
704 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
706 int szArr,sw,iTypppArr;
707 std::vector<int> stdvecTyyppArr;
708 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
709 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
710 if(sw==3)//DataArrayInt
712 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
713 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
714 std::string name=argpt->getName();
716 ret->setName(name.c_str());
718 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
721 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
723 int szArr,sw,iTypppArr;
724 std::vector<int> stdvecTyyppArr;
726 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
727 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
728 if(sw==3)//DataArrayInt
730 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
731 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
732 std::string name=argpt->getName();
734 ret->setName(name.c_str());
737 PyObject *res = PyList_New(2);
738 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
739 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
740 PyList_SetItem(res,0,obj0);
741 PyList_SetItem(res,1,obj1);
745 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
749 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
750 PyObject *res = PyTuple_New(2);
751 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
754 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
756 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
757 PyTuple_SetItem(res,0,obj0);
758 PyTuple_SetItem(res,1,obj1);
762 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
764 std::vector<int> vals=self->getDistributionOfTypes();
766 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
767 PyObject *ret=PyList_New((int)vals.size()/3);
768 for(int j=0;j<(int)vals.size()/3;j++)
770 PyObject *ret1=PyList_New(3);
771 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
772 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
773 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
774 PyList_SetItem(ret,j,ret1);
779 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
781 std::vector<int> code;
782 std::vector<const DataArrayInt *> idsPerType;
783 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
784 convertPyToNewIntArr4(li,1,3,code);
785 return self->checkTypeConsistencyAndContig(code,idsPerType);
788 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
790 std::vector<int> code;
791 std::vector<DataArrayInt *> idsInPflPerType;
792 std::vector<DataArrayInt *> idsPerType;
793 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
794 PyObject *ret=PyTuple_New(3);
797 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
798 PyObject *ret0=PyList_New((int)code.size()/3);
799 for(int j=0;j<(int)code.size()/3;j++)
801 PyObject *ret00=PyList_New(3);
802 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
803 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
804 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
805 PyList_SetItem(ret0,j,ret00);
807 PyTuple_SetItem(ret,0,ret0);
809 PyObject *ret1=PyList_New(idsInPflPerType.size());
810 for(std::size_t j=0;j<idsInPflPerType.size();j++)
811 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
812 PyTuple_SetItem(ret,1,ret1);
813 int n=idsPerType.size();
814 PyObject *ret2=PyList_New(n);
816 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
817 PyTuple_SetItem(ret,2,ret2);
821 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
825 DataArrayDoubleTuple *aa;
826 std::vector<double> bb;
828 int spaceDim=self->getSpaceDimension();
829 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
830 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
831 self->translate(vectorPtr);
834 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
836 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
839 DataArrayDoubleTuple *aa;
840 std::vector<double> bb;
842 int spaceDim=self->getSpaceDimension();
843 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
844 self->rotate(centerPtr,0,alpha);
847 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
849 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
851 DataArrayDouble *a,*a2;
852 DataArrayDoubleTuple *aa,*aa2;
853 std::vector<double> bb,bb2;
855 int spaceDim=self->getSpaceDimension();
856 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
857 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
858 self->rotate(centerPtr,vectorPtr,alpha);
861 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
863 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
864 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
865 PyObject *res=PyList_New(result.size());
866 for(int i=0;iL!=result.end(); i++, iL++)
867 PyList_SetItem(res,i,PyInt_FromLong(*iL));
871 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
873 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
874 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
875 return MEDCouplingMesh::MergeMeshes(tmp);
881 //== MEDCouplingMesh End
883 %include "NormalizedGeometricTypes"
884 %include "MEDCouplingNatureOfFieldEnum"
888 class MEDCouplingNatureOfField
891 static const char *GetRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception);
892 static std::string GetReprNoThrow(NatureOfField nat);
893 static std::string GetAllPossibilitiesStr();
897 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
898 // include "MEDCouplingTimeDiscretization.i"
902 class MEDCouplingGaussLocalization
905 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
906 const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
907 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
908 INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
909 void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
910 int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
911 int getDimension() const throw(INTERP_KERNEL::Exception);
912 int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
913 std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
914 void checkCoherency() const throw(INTERP_KERNEL::Exception);
915 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception);
917 const std::vector<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
918 double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
919 const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
920 double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
921 const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
922 double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
923 void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
924 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
925 void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
926 void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
927 void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
928 void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
930 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
934 %include "MEDCouplingFieldDiscretization.i"
936 //== MEDCouplingPointSet
940 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
943 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
944 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
945 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
946 void zipCoords() throw(INTERP_KERNEL::Exception);
947 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
948 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
949 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
950 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
951 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
952 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
953 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
954 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
955 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
956 static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception);
957 virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
958 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
959 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
960 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
961 virtual DataArrayInt *findBoundaryNodes() const;
962 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
963 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
964 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
965 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
966 virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
967 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
970 std::string __str__() const throw(INTERP_KERNEL::Exception)
972 return self->simpleRepr();
975 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
978 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
979 PyObject *res = PyList_New(2);
980 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
981 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
985 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
987 DataArrayInt *comm, *commIndex;
988 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
989 PyObject *res = PyList_New(2);
990 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
991 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
995 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
997 DataArrayDouble *ret1=self->getCoords();
1000 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
1003 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
1005 int szArr,sw,iTypppArr;
1006 std::vector<int> stdvecTyyppArr;
1007 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1008 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1009 if(sw==3)//DataArrayInt
1011 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1012 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1013 std::string name=argpt->getName();
1015 ret->setName(name.c_str());
1017 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1020 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1022 int szArr,sw,iTypppArr;
1023 std::vector<int> stdvecTyyppArr;
1024 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1025 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1026 if(sw==3)//DataArrayInt
1028 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1029 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1030 std::string name=argpt->getName();
1032 ret->setName(name.c_str());
1034 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1037 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
1039 int szArr,sw,iTypppArr;
1040 std::vector<int> stdvecTyyppArr;
1041 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1042 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1043 if(sw==3)//DataArrayInt
1045 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1046 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1047 std::string name=argpt->getName();
1049 ret->setName(name.c_str());
1051 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1054 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1056 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1057 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1060 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1062 int szArr,sw,iTypppArr;
1063 std::vector<int> stdvecTyyppArr;
1064 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1065 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1066 if(sw==3)//DataArrayInt
1068 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1069 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1070 std::string name=argpt->getName();
1072 ret->setName(name.c_str());
1074 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1077 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1079 int szArr,sw,iTypppArr;
1080 std::vector<int> stdvecTyyppArr;
1081 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1082 self->renumberNodes(tmp,newNbOfNodes);
1085 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1087 int szArr,sw,iTypppArr;
1088 std::vector<int> stdvecTyyppArr;
1089 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1090 self->renumberNodes2(tmp,newNbOfNodes);
1093 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1095 int spaceDim=self->getSpaceDimension();
1097 DataArrayDouble *a,*a2;
1098 DataArrayDoubleTuple *aa,*aa2;
1099 std::vector<double> bb,bb2;
1101 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1102 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1103 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1104 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1105 std::vector<int> nodes;
1106 self->findNodesOnLine(p,v,eps,nodes);
1107 DataArrayInt *ret=DataArrayInt::New();
1108 ret->alloc((int)nodes.size(),1);
1109 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1110 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1112 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1114 int spaceDim=self->getSpaceDimension();
1116 DataArrayDouble *a,*a2;
1117 DataArrayDoubleTuple *aa,*aa2;
1118 std::vector<double> bb,bb2;
1120 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1121 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1122 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1123 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1124 std::vector<int> nodes;
1125 self->findNodesOnPlane(p,v,eps,nodes);
1126 DataArrayInt *ret=DataArrayInt::New();
1127 ret->alloc((int)nodes.size(),1);
1128 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1129 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1132 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1136 DataArrayDoubleTuple *aa;
1137 std::vector<double> bb;
1139 int spaceDim=self->getSpaceDimension();
1140 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1141 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1142 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1143 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1146 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1148 DataArrayInt *c=0,*cI=0;
1152 DataArrayDoubleTuple *aa;
1153 std::vector<double> bb;
1155 int spaceDim=self->getSpaceDimension();
1156 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1157 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1158 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1159 PyObject *ret=PyTuple_New(2);
1160 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1161 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1165 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1167 DataArrayInt *c=0,*cI=0;
1168 int spaceDim=self->getSpaceDimension();
1171 DataArrayDoubleTuple *aa;
1172 std::vector<double> bb;
1175 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1176 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1178 PyObject *ret=PyTuple_New(2);
1179 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1180 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1184 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1188 DataArrayDoubleTuple *aa;
1189 std::vector<double> bb;
1191 int spaceDim=self->getSpaceDimension();
1192 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1193 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1195 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1196 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1199 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1203 std::vector<int> multiVal;
1204 std::pair<int, std::pair<int,int> > slic;
1205 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1206 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1210 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1212 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1214 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1216 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1220 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1222 DataArrayInt *v0=0,*v1=0;
1223 self->findCommonCells(compType,startCellId,v0,v1);
1224 PyObject *res = PyList_New(2);
1225 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1226 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1231 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1234 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1235 if (!SWIG_IsOK(res1))
1238 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1239 self->renumberNodesInConn(tmp);
1243 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1245 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1246 da2->checkAllocated();
1247 self->renumberNodesInConn(da2->getConstPointer());
1251 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1254 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1255 PyObject *ret=PyTuple_New(2);
1256 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1257 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1261 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1263 DataArrayInt *ret=0;
1265 int szArr,sw,iTypppArr;
1266 std::vector<int> stdvecTyyppArr;
1267 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1268 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1272 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1276 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1277 PyObject *res = PyList_New(3);
1278 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1279 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1280 PyList_SetItem(res,2,SWIG_From_int(ret2));
1284 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1288 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1289 PyObject *res = PyList_New(3);
1290 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1291 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1292 PyList_SetItem(res,2,SWIG_From_int(ret2));
1296 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1299 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1300 if (!SWIG_IsOK(res1))
1303 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1304 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1308 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1310 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1311 da2->checkAllocated();
1312 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1316 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1320 std::vector<int> multiVal;
1321 std::pair<int, std::pair<int,int> > slic;
1322 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1323 int nbc=self->getNumberOfCells();
1324 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1331 std::ostringstream oss;
1332 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1333 throw INTERP_KERNEL::Exception(oss.str().c_str());
1336 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1341 int tmp=nbc+singleVal;
1342 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1346 std::ostringstream oss;
1347 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1348 throw INTERP_KERNEL::Exception(oss.str().c_str());
1354 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1358 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1363 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1364 daIntTyypp->checkAllocated();
1365 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1368 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1372 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1375 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1376 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1377 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1378 for(int i=0;i<sz;i++)
1379 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1382 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1385 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1387 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1388 std::vector<double> val3;
1389 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1390 "Rotate2DAlg",2,true,nbNodes);
1392 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1393 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1396 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1399 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1400 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1401 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1402 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1403 for(int i=0;i<sz;i++)
1404 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1407 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1410 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1412 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1413 std::vector<double> val3;
1414 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1415 "Rotate3DAlg",3,true,nbNodes);
1417 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1418 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1419 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1424 //== MEDCouplingPointSet End
1426 class MEDCouplingUMeshCell
1429 INTERP_KERNEL::NormalizedCellType getType() const;
1432 std::string __str__() const throw(INTERP_KERNEL::Exception)
1434 return self->repr();
1437 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1440 const int *r=self->getAllConn(ret2);
1441 PyObject *ret=PyTuple_New(ret2);
1442 for(int i=0;i<ret2;i++)
1443 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1449 class MEDCouplingUMeshCellIterator
1456 MEDCouplingUMeshCell *ret=self->nextt();
1458 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1461 PyErr_SetString(PyExc_StopIteration,"No more data.");
1468 class MEDCouplingUMeshCellByTypeIterator
1471 ~MEDCouplingUMeshCellByTypeIterator();
1476 MEDCouplingUMeshCellEntry *ret=self->nextt();
1478 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1481 PyErr_SetString(PyExc_StopIteration,"No more data.");
1488 class MEDCouplingUMeshCellByTypeEntry
1491 ~MEDCouplingUMeshCellByTypeEntry();
1494 MEDCouplingUMeshCellByTypeIterator *__iter__()
1496 return self->iterator();
1501 class MEDCouplingUMeshCellEntry
1504 INTERP_KERNEL::NormalizedCellType getType() const;
1505 int getNumberOfElems() const;
1508 MEDCouplingUMeshCellIterator *__iter__()
1510 return self->iterator();
1515 //== MEDCouplingUMesh
1517 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1520 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1521 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1522 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1523 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1524 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1525 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1526 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1527 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1528 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1529 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1530 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1531 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1532 void computeTypes() throw(INTERP_KERNEL::Exception);
1533 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1534 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1536 DataArrayInt *conformize2D(double eps) throw(INTERP_KERNEL::Exception);
1537 DataArrayInt *colinearize2D(double eps) throw(INTERP_KERNEL::Exception);
1538 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1539 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1540 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1541 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1542 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1543 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1544 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1545 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1546 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1547 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1548 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1549 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1550 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1551 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1552 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1553 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1554 bool isFullyQuadratic() const throw(INTERP_KERNEL::Exception);
1555 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1556 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1557 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1558 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1559 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1560 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1561 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1562 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1563 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1564 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1565 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1566 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1567 DataArrayDouble *computePlaneEquationOf3DFaces() const throw(INTERP_KERNEL::Exception);
1568 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1569 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1570 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1571 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1572 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1573 DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1574 DataArrayInt *buildUnionOf2DMesh() const throw(INTERP_KERNEL::Exception);
1575 DataArrayInt *buildUnionOf3DMesh() const throw(INTERP_KERNEL::Exception);
1576 DataArrayDouble *getBoundingBoxForBBTreeFast() const throw(INTERP_KERNEL::Exception);
1577 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1578 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1579 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);
1580 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1581 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1582 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1583 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1584 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1586 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1588 return MEDCouplingUMesh::New();
1591 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1593 return MEDCouplingUMesh::New(meshName,meshDim);
1596 std::string __str__() const throw(INTERP_KERNEL::Exception)
1598 return self->simpleRepr();
1601 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1603 std::ostringstream oss;
1604 self->reprQuickOverview(oss);
1608 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1610 return self->cellIterator();
1613 PyObject *getAllGeoTypesSorted() const throw(INTERP_KERNEL::Exception)
1615 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
1616 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1617 PyObject *res=PyList_New(result.size());
1618 for(int i=0;iL!=result.end(); i++, iL++)
1619 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1623 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1627 std::vector<int> multiVal;
1628 std::pair<int, std::pair<int,int> > slic;
1629 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1630 int nbc=self->getNumberOfCells();
1631 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1638 std::ostringstream oss;
1639 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1640 throw INTERP_KERNEL::Exception(oss.str().c_str());
1644 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1651 int tmp=nbc+singleVal;
1652 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1657 std::ostringstream oss;
1658 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1659 throw INTERP_KERNEL::Exception(oss.str().c_str());
1665 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1671 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1672 daIntTyypp->checkAllocated();
1673 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1677 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1681 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1685 std::vector<int> multiVal;
1686 std::pair<int, std::pair<int,int> > slic;
1687 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1688 int nbc=self->getNumberOfCells();
1689 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1696 std::ostringstream oss;
1697 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1698 throw INTERP_KERNEL::Exception(oss.str().c_str());
1702 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1709 int tmp=nbc+singleVal;
1710 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1715 std::ostringstream oss;
1716 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1717 throw INTERP_KERNEL::Exception(oss.str().c_str());
1723 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1728 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1734 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1735 daIntTyypp->checkAllocated();
1736 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1740 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1744 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1746 int szArr,sw,iTypppArr;
1747 std::vector<int> stdvecTyyppArr;
1748 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1751 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1752 throw INTERP_KERNEL::Exception(oss.str().c_str());
1754 self->insertNextCell(type,size,tmp);
1757 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1759 int szArr,sw,iTypppArr;
1760 std::vector<int> stdvecTyyppArr;
1761 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1762 self->insertNextCell(type,szArr,tmp);
1765 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1767 DataArrayInt *ret=self->getNodalConnectivity();
1772 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1774 DataArrayInt *ret=self->getNodalConnectivityIndex();
1780 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1782 int szArr,sw,iTypppArr;
1783 std::vector<int> stdvecTyyppArr;
1784 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1785 int nbOfDepthPeelingPerformed=0;
1786 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1787 PyObject *res=PyTuple_New(2);
1788 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1789 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1793 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1795 DataArrayInt *v0=0,*v1=0;
1796 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1797 PyObject *res = PyList_New(2);
1798 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1799 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1803 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1807 DataArrayDoubleTuple *aa;
1808 std::vector<double> bb;
1810 int nbOfCompo=self->getSpaceDimension();
1811 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1814 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1815 PyObject *ret=PyTuple_New(2);
1816 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1817 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1821 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1823 DataArrayInt *ret1=0;
1824 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1825 PyObject *ret=PyTuple_New(2);
1826 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1827 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1831 PyObject *tetrahedrize(int policy) throw(INTERP_KERNEL::Exception)
1834 DataArrayInt *ret1(0);
1835 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
1836 PyObject *ret=PyTuple_New(3);
1837 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
1838 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1839 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
1843 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1845 std::vector<int> cells;
1846 self->checkButterflyCells(cells,eps);
1847 DataArrayInt *ret=DataArrayInt::New();
1848 ret->alloc((int)cells.size(),1);
1849 std::copy(cells.begin(),cells.end(),ret->getPointer());
1850 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1853 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1855 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1857 PyObject *ret = PyList_New(sz);
1858 for(int i=0;i<sz;i++)
1859 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1863 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1865 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1866 int sz=retCpp.size();
1867 PyObject *ret=PyList_New(sz);
1868 for(int i=0;i<sz;i++)
1869 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1873 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1876 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1877 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1878 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1881 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1884 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1885 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1889 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1892 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1893 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1897 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1899 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1900 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1901 PyObject *ret=PyTuple_New(3);
1902 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1903 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1904 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1908 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1910 DataArrayInt *tmp0=0,*tmp1=0;
1911 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1912 PyObject *ret=PyTuple_New(2);
1913 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1914 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1918 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1922 std::vector<int> multiVal;
1923 std::pair<int, std::pair<int,int> > slic;
1924 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1925 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1929 return self->duplicateNodes(&singleVal,&singleVal+1);
1931 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
1933 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
1935 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1939 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
1943 std::vector<int> multiVal;
1944 std::pair<int, std::pair<int,int> > slic;
1945 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1946 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1950 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
1952 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
1954 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
1956 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1960 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
1963 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1964 DataArrayInt *tmp0,*tmp1=0;
1965 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
1966 PyObject *ret=PyTuple_New(2);
1967 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1968 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1972 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const throw(INTERP_KERNEL::Exception)
1974 DataArrayInt *ret0=0,*ret1=0;
1975 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
1976 PyObject *ret=PyTuple_New(2);
1977 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1978 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1982 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1984 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1985 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1986 DataArrayInt *ret1=0,*ret2=0;
1987 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
1988 PyObject *ret=PyTuple_New(3);
1989 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1990 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1991 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1995 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1997 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1998 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1999 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2000 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2003 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
2006 std::vector<const MEDCouplingUMesh *> meshes;
2007 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2008 std::vector<DataArrayInt *> corr;
2009 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2011 PyObject *ret1=PyList_New(sz);
2012 for(int i=0;i<sz;i++)
2013 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2014 PyObject *ret=PyList_New(2);
2015 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2016 PyList_SetItem(ret,1,ret1);
2020 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2022 std::vector<MEDCouplingUMesh *> meshes;
2023 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2024 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2027 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
2029 std::vector<MEDCouplingUMesh *> meshes;
2030 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2031 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2034 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
2038 std::vector<int> multiVal;
2039 std::pair<int, std::pair<int,int> > slic;
2040 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2042 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2043 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2047 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2049 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2051 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2053 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2057 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2059 DataArrayInt *arrOut=0,*arrIndexOut=0;
2062 std::vector<int> multiVal;
2063 std::pair<int, std::pair<int,int> > slic;
2064 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2066 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2067 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2072 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2077 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2082 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2086 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2088 PyObject *ret=PyTuple_New(2);
2089 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2090 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2094 static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2096 DataArrayInt *arrOut=0,*arrIndexOut=0;
2097 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2098 PyObject *ret=PyTuple_New(2);
2099 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2100 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2104 static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2106 if(!PySlice_Check(slic))
2107 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !");
2108 Py_ssize_t strt=2,stp=2,step=2;
2109 PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
2111 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !");
2112 arrIndxIn->checkAllocated();
2113 if(arrIndxIn->getNumberOfComponents()!=1)
2114 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !");
2115 GetIndicesOfSlice(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !");
2116 DataArrayInt *arrOut=0,*arrIndexOut=0;
2117 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2118 PyObject *ret=PyTuple_New(2);
2119 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2120 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2124 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2125 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2126 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2128 DataArrayInt *arrOut=0,*arrIndexOut=0;
2131 std::vector<int> multiVal;
2132 std::pair<int, std::pair<int,int> > slic;
2133 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2135 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2136 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2141 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2146 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2151 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2155 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2157 PyObject *ret=PyTuple_New(2);
2158 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2159 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2163 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2164 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
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::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2173 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2178 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2183 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2188 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2192 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2196 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2200 DataArrayDoubleTuple *aa;
2201 std::vector<double> bb;
2203 int spaceDim=self->getSpaceDimension();
2204 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2205 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2207 std::vector<int> cells;
2208 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2209 DataArrayInt *ret=DataArrayInt::New();
2210 ret->alloc((int)cells.size(),1);
2211 std::copy(cells.begin(),cells.end(),ret->getPointer());
2212 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2215 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2219 DataArrayDoubleTuple *aa;
2220 std::vector<double> bb;
2222 int spaceDim=self->getSpaceDimension();
2223 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2224 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2225 self->orientCorrectly2DCells(v,polyOnly);
2228 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2230 std::vector<int> cells;
2231 self->arePolyhedronsNotCorrectlyOriented(cells);
2232 DataArrayInt *ret=DataArrayInt::New();
2233 ret->alloc((int)cells.size(),1);
2234 std::copy(cells.begin(),cells.end(),ret->getPointer());
2235 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2238 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2242 self->getFastAveragePlaneOfThis(vec,pos);
2244 std::copy(vec,vec+3,vals);
2245 std::copy(pos,pos+3,vals+3);
2246 return convertDblArrToPyListOfTuple(vals,3,2);
2249 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2251 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2252 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2253 return MEDCouplingUMesh::MergeUMeshes(tmp);
2256 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2259 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2260 PyObject *ret=PyTuple_New(2);
2261 PyObject *ret0Py=ret0?Py_True:Py_False;
2263 PyTuple_SetItem(ret,0,ret0Py);
2264 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2268 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2271 bool ret0=self->areCellsIncludedIn2(other,ret1);
2272 PyObject *ret=PyTuple_New(2);
2273 PyObject *ret0Py=ret0?Py_True:Py_False;
2275 PyTuple_SetItem(ret,0,ret0Py);
2276 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2280 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2282 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2283 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2284 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2285 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2286 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2287 PyObject *ret=PyTuple_New(5);
2288 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2289 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2290 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2291 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2292 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2296 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2298 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2299 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2300 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2301 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2302 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2303 PyObject *ret=PyTuple_New(5);
2304 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2305 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2306 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2307 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2308 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2312 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2314 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2315 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2316 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2317 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2318 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2319 PyObject *ret=PyTuple_New(5);
2320 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2321 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2322 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2323 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2324 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2328 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2330 DataArrayInt *neighbors=0,*neighborsIdx=0;
2331 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2332 PyObject *ret=PyTuple_New(2);
2333 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2334 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2338 PyObject *computeNeighborsOfNodes() const throw(INTERP_KERNEL::Exception)
2340 DataArrayInt *neighbors=0,*neighborsIdx=0;
2341 self->computeNeighborsOfNodes(neighbors,neighborsIdx);
2342 PyObject *ret=PyTuple_New(2);
2343 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2344 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2348 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2350 DataArrayInt *neighbors=0,*neighborsIdx=0;
2351 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2352 PyObject *ret=PyTuple_New(2);
2353 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2354 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2358 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2360 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2361 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2362 DataArrayInt *d2,*d3,*d4,*dd5;
2363 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2364 PyObject *ret=PyTuple_New(7);
2365 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2366 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2367 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2368 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2369 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2370 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2371 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2375 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2378 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2379 da->checkAllocated();
2380 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2383 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2386 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2387 da->checkAllocated();
2388 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2391 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2394 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2395 da->checkAllocated();
2396 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2399 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2402 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2403 da->checkAllocated();
2404 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2405 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2406 PyObject *res = PyList_New(result.size());
2407 for (int i=0;iL!=result.end(); i++, iL++)
2408 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2412 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2415 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2416 da->checkAllocated();
2417 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2418 ret->setName(da->getName().c_str());
2422 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2424 DataArrayInt *cellNb1=0,*cellNb2=0;
2425 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2426 PyObject *ret=PyTuple_New(3);
2427 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2428 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2429 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2433 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2435 int spaceDim=self->getSpaceDimension();
2437 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2439 DataArrayDouble *a,*a2;
2440 DataArrayDoubleTuple *aa,*aa2;
2441 std::vector<double> bb,bb2;
2443 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2444 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2445 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2446 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2448 DataArrayInt *cellIds=0;
2449 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2450 PyObject *ret=PyTuple_New(2);
2451 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2452 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2456 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2458 int spaceDim=self->getSpaceDimension();
2460 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2462 DataArrayDouble *a,*a2;
2463 DataArrayDoubleTuple *aa,*aa2;
2464 std::vector<double> bb,bb2;
2466 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2467 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2468 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2469 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2471 DataArrayInt *cellIds=0;
2472 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2473 PyObject *ret=PyTuple_New(2);
2474 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2475 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2479 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2481 int spaceDim=self->getSpaceDimension();
2483 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2485 DataArrayDouble *a,*a2;
2486 DataArrayDoubleTuple *aa,*aa2;
2487 std::vector<double> bb,bb2;
2489 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2490 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2491 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2492 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2493 return self->getCellIdsCrossingPlane(orig,vect,eps);
2496 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2500 std::vector<int> pos2;
2501 DataArrayInt *pos3=0;
2502 DataArrayIntTuple *pos4=0;
2503 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2508 self->convertToPolyTypes(&pos1,&pos1+1);
2515 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2520 self->convertToPolyTypes(pos3->begin(),pos3->end());
2524 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2528 void convertAllToPoly();
2529 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2530 bool unPolyze() throw(INTERP_KERNEL::Exception);
2531 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2532 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2533 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2536 //== MEDCouplingUMesh End
2538 //== MEDCouplingExtrudedMesh
2540 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2543 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2544 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2546 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2548 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2551 std::string __str__() const throw(INTERP_KERNEL::Exception)
2553 return self->simpleRepr();
2556 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2558 std::ostringstream oss;
2559 self->reprQuickOverview(oss);
2563 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2565 MEDCouplingUMesh *ret=self->getMesh2D();
2568 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2570 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2572 MEDCouplingUMesh *ret=self->getMesh1D();
2575 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2577 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2579 DataArrayInt *ret=self->getMesh3DIds();
2582 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2587 //== MEDCouplingExtrudedMesh End
2589 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2592 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2593 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2594 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2595 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2596 virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2597 virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
2600 virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2602 int szArr,sw,iTypppArr;
2603 std::vector<int> stdvecTyyppArr;
2604 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2605 self->insertNextCell(tmp,tmp+szArr);
2608 virtual DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2610 DataArrayInt *ret=self->getNodalConnectivity();
2611 if(ret) ret->incrRef();
2615 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2617 std::vector< const MEDCoupling1GTUMesh *> parts;
2618 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
2619 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
2624 //== MEDCoupling1SGTUMesh
2626 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2629 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2630 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2631 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2632 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2633 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2634 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2635 MEDCoupling1GTUMesh *computeDualMesh() const throw(INTERP_KERNEL::Exception);
2636 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const throw(INTERP_KERNEL::Exception);
2637 DataArrayInt *sortHexa8EachOther() throw(INTERP_KERNEL::Exception);
2640 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2642 return MEDCoupling1SGTUMesh::New(name,type);
2645 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2647 return MEDCoupling1SGTUMesh::New(m);
2650 std::string __str__() const throw(INTERP_KERNEL::Exception)
2652 return self->simpleRepr();
2655 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2657 std::ostringstream oss;
2658 self->reprQuickOverview(oss);
2662 PyObject *structurizeMe(double eps=1e-12) const throw(INTERP_KERNEL::Exception)
2664 DataArrayInt *cellPerm(0),*nodePerm(0);
2665 MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps));
2666 PyObject *ret(PyTuple_New(3));
2667 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 ));
2668 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2669 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2673 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2675 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2676 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2677 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2680 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2682 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2683 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2684 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2689 //== MEDCoupling1SGTUMesh End
2691 //== MEDCoupling1DGTUMesh
2693 class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2696 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2697 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2698 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
2699 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2700 bool isPacked() const throw(INTERP_KERNEL::Exception);
2703 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2705 return MEDCoupling1DGTUMesh::New(name,type);
2708 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2710 return MEDCoupling1DGTUMesh::New(m);
2713 std::string __str__() const throw(INTERP_KERNEL::Exception)
2715 return self->simpleRepr();
2718 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2720 std::ostringstream oss;
2721 self->reprQuickOverview(oss);
2725 DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
2727 DataArrayInt *ret=self->getNodalConnectivityIndex();
2728 if(ret) ret->incrRef();
2732 PyObject *retrievePackedNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2734 DataArrayInt *ret1=0,*ret2=0;
2735 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
2736 PyObject *ret0Py=ret0?Py_True:Py_False;
2738 PyObject *ret=PyTuple_New(3);
2739 PyTuple_SetItem(ret,0,ret0Py);
2740 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2741 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2745 PyObject *copyWithNodalConnectivityPacked() const throw(INTERP_KERNEL::Exception)
2748 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
2749 PyObject *ret=PyTuple_New(2);
2750 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
2751 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
2752 PyTuple_SetItem(ret,1,ret1Py);
2756 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2758 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2759 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2760 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
2763 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2765 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2766 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2767 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
2770 static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt) throw(INTERP_KERNEL::Exception)
2772 std::vector<const ParaMEDMEM::DataArrayInt *> tmp;
2773 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2774 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
2779 //== MEDCoupling1DGTUMeshEnd
2781 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2784 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2785 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2786 int getNumberOfCellsOfSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2787 int getSpaceDimensionOnNodeStruct() const throw(INTERP_KERNEL::Exception);
2788 virtual std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2789 std::vector<int> getCellGridStructure() const throw(INTERP_KERNEL::Exception);
2790 MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception);
2791 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
2792 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2793 static int DeduceNumberOfGivenStructure(const std::vector<int>& st) throw(INTERP_KERNEL::Exception);
2794 static std::vector<int> GetSplitVectFromStruct(const std::vector<int>& strct) throw(INTERP_KERNEL::Exception);
2797 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const throw(INTERP_KERNEL::Exception)
2799 int tmpp1=-1,tmpp2=-1;
2800 std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
2801 std::vector< std::pair<int,int> > inp;
2805 for(int i=0;i<tmpp1;i++)
2806 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2811 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
2812 inp.resize(tmpp1/2);
2813 for(int i=0;i<tmpp1/2;i++)
2814 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2817 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
2818 return self->buildStructuredSubPart(inp);
2821 static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) throw(INTERP_KERNEL::Exception)
2823 std::vector< std::pair<int,int> > inp;
2824 convertPyToVectorPairInt(part,inp);
2826 int szArr,sw,iTypppArr;
2827 std::vector<int> stdvecTyyppArr;
2828 const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
2829 std::vector<int> tmp5(tmp4,tmp4+szArr);
2831 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
2834 static int DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part) throw(INTERP_KERNEL::Exception)
2836 std::vector< std::pair<int,int> > inp;
2837 convertPyToVectorPairInt(part,inp);
2838 return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp);
2841 static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) throw(INTERP_KERNEL::Exception)
2843 int szArr,sw,iTypppArr;
2844 std::vector<int> stdvecTyyppArr;
2845 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2846 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
2849 static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2851 int szArr,sw,iTypppArr;
2852 std::vector<int> stdvecTyyppArr;
2853 const int *tmp(convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr));
2854 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
2857 static std::vector<int> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat) throw(INTERP_KERNEL::Exception)
2859 std::vector< std::pair<int,int> > inp;
2860 convertPyToVectorPairInt(partCompactFormat,inp);
2861 return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp);
2864 static PyObject *IsPartStructured(PyObject *li, PyObject *st) throw(INTERP_KERNEL::Exception)
2866 int szArr,sw,iTypppArr;
2867 std::vector<int> stdvecTyyppArr;
2868 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2869 int szArr2,sw2,iTypppArr2;
2870 std::vector<int> stdvecTyyppArr2;
2871 const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
2872 std::vector<int> tmp3(tmp2,tmp2+szArr2);
2873 std::vector< std::pair<int,int> > partCompactFormat;
2874 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
2875 PyObject *ret=PyTuple_New(2);
2876 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
2877 PyTuple_SetItem(ret,0,ret0Py);
2878 PyObject *ret1Py=PyList_New(partCompactFormat.size());
2879 for(std::size_t i=0;i<partCompactFormat.size();i++)
2881 PyObject *tmp4=PyTuple_New(2);
2882 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
2883 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
2884 PyList_SetItem(ret1Py,i,tmp4);
2886 PyTuple_SetItem(ret,1,ret1Py);
2892 //== MEDCouplingCMesh
2894 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2897 static MEDCouplingCMesh *New() throw(INTERP_KERNEL::Exception);
2898 static MEDCouplingCMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
2899 MEDCouplingCMesh *clone(bool recDeepCpy) const;
2900 void setCoords(const DataArrayDouble *coordsX,
2901 const DataArrayDouble *coordsY=0,
2902 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
2903 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
2905 MEDCouplingCMesh() throw(INTERP_KERNEL::Exception)
2907 return MEDCouplingCMesh::New();
2909 MEDCouplingCMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
2911 return MEDCouplingCMesh::New(meshName);
2913 std::string __str__() const throw(INTERP_KERNEL::Exception)
2915 return self->simpleRepr();
2917 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2919 std::ostringstream oss;
2920 self->reprQuickOverview(oss);
2923 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
2925 DataArrayDouble *ret=self->getCoordsAt(i);
2933 //== MEDCouplingCMesh End
2935 //== MEDCouplingCurveLinearMesh
2937 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2940 static MEDCouplingCurveLinearMesh *New() throw(INTERP_KERNEL::Exception);
2941 static MEDCouplingCurveLinearMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
2942 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
2943 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
2945 MEDCouplingCurveLinearMesh() throw(INTERP_KERNEL::Exception)
2947 return MEDCouplingCurveLinearMesh::New();
2949 MEDCouplingCurveLinearMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
2951 return MEDCouplingCurveLinearMesh::New(meshName);
2953 std::string __str__() const throw(INTERP_KERNEL::Exception)
2955 return self->simpleRepr();
2957 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2959 std::ostringstream oss;
2960 self->reprQuickOverview(oss);
2963 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
2965 DataArrayDouble *ret=self->getCoords();
2970 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
2972 int szArr,sw,iTypppArr;
2973 std::vector<int> stdvecTyyppArr;
2974 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
2975 self->setNodeGridStructure(tmp,tmp+szArr);
2980 //== MEDCouplingCurveLinearMesh End
2982 //== MEDCouplingIMesh
2984 class MEDCouplingIMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2987 static MEDCouplingIMesh *New() throw(INTERP_KERNEL::Exception);
2989 void setSpaceDimension(int spaceDim) throw(INTERP_KERNEL::Exception);
2990 std::vector<int> getNodeStruct() const throw(INTERP_KERNEL::Exception);
2991 std::vector<double> getOrigin() const throw(INTERP_KERNEL::Exception);
2992 std::vector<double> getDXYZ() const throw(INTERP_KERNEL::Exception);
2993 void setAxisUnit(const std::string& unitName) throw(INTERP_KERNEL::Exception);
2994 std::string getAxisUnit() const throw(INTERP_KERNEL::Exception);
2995 double getMeasureOfAnyCell() const throw(INTERP_KERNEL::Exception);
2996 MEDCouplingCMesh *convertToCartesian() const throw(INTERP_KERNEL::Exception);
2997 void refineWithFactor(int factor) throw(INTERP_KERNEL::Exception);
3002 return MEDCouplingIMesh::New();
3004 static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3006 static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
3007 static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
3008 const int *nodeStrctPtr(0);
3009 const double *originPtr(0),*dxyzPtr(0);
3011 std::vector<int> bb0;
3012 nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
3015 std::vector<double> bb,bb2;
3017 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
3018 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
3020 return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
3023 MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3025 return ParaMEDMEM_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
3028 void setNodeStruct(PyObject *nodeStrct) throw(INTERP_KERNEL::Exception)
3031 std::vector<int> bb0;
3032 const int *nodeStrctPtr(convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0));
3033 self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
3036 void setOrigin(PyObject *origin) throw(INTERP_KERNEL::Exception)
3038 static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3041 DataArrayDoubleTuple *aa;
3042 std::vector<double> bb;
3044 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
3045 self->setOrigin(originPtr,originPtr+nbTuples);
3048 void setDXYZ(PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3050 static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3053 DataArrayDoubleTuple *aa;
3054 std::vector<double> bb;
3056 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
3057 self->setDXYZ(originPtr,originPtr+nbTuples);
3060 static void CondenseFineToCoarse(DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse) throw(INTERP_KERNEL::Exception)
3062 std::vector< std::pair<int,int> > inp;
3063 convertPyToVectorPairInt(fineLocInCoarse,inp);
3064 MEDCouplingIMesh::CondenseFineToCoarse(coarseDA,coarseSt,fineDA,inp);
3067 std::string __str__() const throw(INTERP_KERNEL::Exception)
3069 return self->simpleRepr();
3071 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3073 std::ostringstream oss;
3074 self->reprQuickOverview(oss);
3080 //== MEDCouplingIMesh End
3084 namespace ParaMEDMEM
3086 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
3089 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
3090 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
3091 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3092 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3093 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
3094 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
3095 void setName(const char *name) throw(INTERP_KERNEL::Exception);
3096 std::string getDescription() const throw(INTERP_KERNEL::Exception);
3097 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
3098 std::string getName() const throw(INTERP_KERNEL::Exception);
3099 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
3100 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
3101 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
3102 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
3103 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
3104 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
3105 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
3106 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3107 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
3108 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
3109 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
3110 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
3111 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
3112 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
3113 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
3114 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3116 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
3118 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3121 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3124 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
3126 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3129 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3132 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
3134 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
3135 return convertIntArrToPyList3(ret);
3138 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
3141 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
3142 PyObject *ret=PyTuple_New(2);
3143 PyObject *ret0Py=ret0?Py_True:Py_False;
3145 PyTuple_SetItem(ret,0,ret0Py);
3146 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3150 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
3152 DataArrayInt *ret1=0;
3153 MEDCouplingMesh *ret0=0;
3155 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3156 if (!SWIG_IsOK(res1))
3159 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3160 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3164 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3166 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3167 da2->checkAllocated();
3168 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3170 PyObject *res = PyList_New(2);
3171 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3172 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3176 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
3178 DataArrayInt *ret1=0;
3180 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3181 PyObject *res=PyTuple_New(2);
3182 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3184 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3187 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3188 PyTuple_SetItem(res,1,res1);
3193 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3196 int v0; std::vector<int> v1;
3197 const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
3198 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3201 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3202 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3205 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3206 if (!SWIG_IsOK(res1))
3209 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3210 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3214 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3216 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3217 da2->checkAllocated();
3218 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3222 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3224 std::vector<int> tmp;
3225 self->getCellIdsHavingGaussLocalization(locId,tmp);
3226 DataArrayInt *ret=DataArrayInt::New();
3227 ret->alloc((int)tmp.size(),1);
3228 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3229 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3232 int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
3234 std::vector<int> inp0;
3235 convertPyToNewIntArr4(code,1,3,inp0);
3236 std::vector<const DataArrayInt *> inp1;
3237 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(idsPerType,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",inp1);
3238 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3243 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3246 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3247 static MEDCouplingFieldTemplate *New(TypeOfField type);
3248 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3249 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3252 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3254 return MEDCouplingFieldTemplate::New(f);
3257 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3259 return MEDCouplingFieldTemplate::New(type);
3262 std::string __str__() const throw(INTERP_KERNEL::Exception)
3264 return self->simpleRepr();
3267 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3269 std::ostringstream oss;
3270 self->reprQuickOverview(oss);
3276 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3279 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3280 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3281 void setTimeUnit(const std::string& unit);
3282 std::string getTimeUnit() const;
3283 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3284 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3285 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3286 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3287 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3288 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
3289 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3290 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3291 MEDCouplingFieldDouble *deepCpy() const;
3292 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3293 MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
3294 MEDCouplingFieldDouble *cellToNodeDiscretization() const throw(INTERP_KERNEL::Exception);
3295 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3296 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3297 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3298 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3299 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3300 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3301 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3302 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3303 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3304 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3305 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
3306 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3307 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3308 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3309 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3310 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3311 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3312 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3313 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3314 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3315 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3316 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3317 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3318 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3319 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3320 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3321 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3322 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3323 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3324 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3325 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3326 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3327 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3328 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3329 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3330 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3331 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3332 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3333 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3334 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3335 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3336 void fillFromAnalytic(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3337 void fillFromAnalytic2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3338 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3339 void applyFunc(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3340 void applyFunc2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3341 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3342 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3343 void applyFunc(const std::string& func) throw(INTERP_KERNEL::Exception);
3344 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
3345 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
3346 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3347 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3348 double getMinValue() const throw(INTERP_KERNEL::Exception);
3349 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3350 double norm2() const throw(INTERP_KERNEL::Exception);
3351 double normMax() const throw(INTERP_KERNEL::Exception);
3352 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3353 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3354 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3355 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3356 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3357 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3358 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3359 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3360 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3361 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3362 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3363 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3364 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3365 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3366 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3367 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3368 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3369 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3370 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3371 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3372 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3373 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3375 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3377 return MEDCouplingFieldDouble::New(type,td);
3380 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3382 return MEDCouplingFieldDouble::New(ft,td);
3385 std::string __str__() const throw(INTERP_KERNEL::Exception)
3387 return self->simpleRepr();
3390 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3392 std::ostringstream oss;
3393 self->reprQuickOverview(oss);
3397 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3399 DataArrayDouble *ret=self->getArray();
3405 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3407 std::vector<DataArrayDouble *> arrs=self->getArrays();
3408 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3412 PyObject *ret=PyTuple_New(sz);
3413 for(int i=0;i<sz;i++)
3416 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3418 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3423 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3425 std::vector<const DataArrayDouble *> tmp;
3426 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3428 std::vector<DataArrayDouble *> arrs(sz);
3429 for(int i=0;i<sz;i++)
3430 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3431 self->setArrays(arrs);
3434 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3436 DataArrayDouble *ret=self->getEndArray();
3442 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3446 DataArrayDoubleTuple *aa;
3447 std::vector<double> bb;
3449 const MEDCouplingMesh *mesh=self->getMesh();
3451 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3452 int spaceDim=mesh->getSpaceDimension();
3453 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3454 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3456 int sz=self->getNumberOfComponents();
3457 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3458 self->getValueOn(spaceLoc,res);
3459 return convertDblArrToPyList(res,sz);
3462 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3464 int sz=self->getNumberOfComponents();
3465 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3466 self->getValueOnPos(i,j,k,res);
3467 return convertDblArrToPyList(res,sz);
3470 DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
3472 const MEDCouplingMesh *mesh(self->getMesh());
3474 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3477 double v0; ParaMEDMEM::DataArrayDouble *v1(0); ParaMEDMEM::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
3478 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
3479 mesh->getSpaceDimension(),true,nbPts);
3480 return self->getValueOnMulti(inp,nbPts);
3483 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3487 DataArrayDoubleTuple *aa;
3488 std::vector<double> bb;
3490 const MEDCouplingMesh *mesh=self->getMesh();
3492 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3493 int spaceDim=mesh->getSpaceDimension();
3494 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3495 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3498 int sz=self->getNumberOfComponents();
3499 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3500 self->getValueOn(spaceLoc,time,res);
3501 return convertDblArrToPyList(res,sz);
3504 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3506 if(self->getArray()!=0)
3507 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3510 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3511 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3512 self->setArray(arr);
3516 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3519 double tmp0=self->getTime(tmp1,tmp2);
3520 PyObject *res = PyList_New(3);
3521 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3522 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3523 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3527 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3530 double tmp0=self->getStartTime(tmp1,tmp2);
3531 PyObject *res = PyList_New(3);
3532 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3533 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3534 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3538 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3541 double tmp0=self->getEndTime(tmp1,tmp2);
3542 PyObject *res = PyList_New(3);
3543 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3544 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3545 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3548 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3550 int sz=self->getNumberOfComponents();
3551 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3552 self->accumulate(tmp);
3553 return convertDblArrToPyList(tmp,sz);
3555 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3557 int sz=self->getNumberOfComponents();
3558 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3559 self->integral(isWAbs,tmp);
3560 return convertDblArrToPyList(tmp,sz);
3562 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3564 int sz=self->getNumberOfComponents();
3565 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3566 self->getWeightedAverageValue(tmp,isWAbs);
3567 return convertDblArrToPyList(tmp,sz);
3569 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3571 int sz=self->getNumberOfComponents();
3572 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3574 return convertDblArrToPyList(tmp,sz);
3576 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3578 int sz=self->getNumberOfComponents();
3579 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3581 return convertDblArrToPyList(tmp,sz);
3583 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3585 int szArr,sw,iTypppArr;
3586 std::vector<int> stdvecTyyppArr;
3587 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3588 self->renumberCells(tmp,check);
3591 void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3593 int szArr,sw,iTypppArr;
3594 std::vector<int> stdvecTyyppArr;
3595 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3596 self->renumberCellsWithoutMesh(tmp,check);
3599 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3601 int szArr,sw,iTypppArr;
3602 std::vector<int> stdvecTyyppArr;
3603 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3604 self->renumberNodes(tmp,eps);
3607 void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3609 int szArr,sw,iTypppArr;
3610 std::vector<int> stdvecTyyppArr;
3611 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3612 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
3615 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3619 std::vector<int> multiVal;
3620 std::pair<int, std::pair<int,int> > slic;
3621 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3622 const MEDCouplingMesh *mesh=self->getMesh();
3624 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3625 int nbc=mesh->getNumberOfCells();
3626 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3633 std::ostringstream oss;
3634 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3635 throw INTERP_KERNEL::Exception(oss.str().c_str());
3638 return self->buildSubPart(&singleVal,&singleVal+1);
3643 int tmp=nbc+singleVal;
3644 return self->buildSubPart(&tmp,&tmp+1);
3648 std::ostringstream oss;
3649 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3650 throw INTERP_KERNEL::Exception(oss.str().c_str());
3656 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3660 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3665 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3666 daIntTyypp->checkAllocated();
3667 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3670 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3674 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3676 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";
3677 if(PyTuple_Check(li))
3679 Py_ssize_t sz=PyTuple_Size(li);
3681 throw INTERP_KERNEL::Exception(msg);
3682 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3685 std::vector<int> multiVal;
3686 std::pair<int, std::pair<int,int> > slic;
3687 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3688 if(!self->getArray())
3689 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3691 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3692 catch(INTERP_KERNEL::Exception& e)
3693 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3694 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3695 DataArrayDouble *ret0Arr=ret0->getArray();
3697 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3702 std::vector<int> v2(1,singleVal);
3703 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3704 ret0->setArray(aarr);
3709 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3710 ret0->setArray(aarr);
3715 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3716 std::vector<int> v2(nbOfComp);
3717 for(int i=0;i<nbOfComp;i++)
3718 v2[i]=slic.first+i*slic.second.second;
3719 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3720 ret0->setArray(aarr);
3724 throw INTERP_KERNEL::Exception(msg);
3729 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3732 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3735 double r1=self->getMaxValue2(tmp);
3736 PyObject *ret=PyTuple_New(2);
3737 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3738 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3742 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3745 double r1=self->getMinValue2(tmp);
3746 PyObject *ret=PyTuple_New(2);
3747 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3748 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3752 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3754 std::vector<int> tmp;
3755 convertPyToNewIntArr3(li,tmp);
3756 return self->keepSelectedComponents(tmp);
3759 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3761 std::vector<int> tmp;
3762 convertPyToNewIntArr3(li,tmp);
3763 self->setSelectedComponents(f,tmp);
3766 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3769 DataArrayDouble *a,*a2;
3770 DataArrayDoubleTuple *aa,*aa2;
3771 std::vector<double> bb,bb2;
3774 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
3775 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
3776 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3777 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3779 return self->extractSlice3D(orig,vect,eps);
3782 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3784 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
3787 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3789 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
3792 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3794 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.";
3795 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
3798 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3800 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3802 return (*self)-(*other);
3804 throw INTERP_KERNEL::Exception(msg);
3809 DataArrayDoubleTuple *aa;
3810 std::vector<double> bb;
3812 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3817 if(!self->getArray())
3818 throw INTERP_KERNEL::Exception(msg2);
3819 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3820 ret->applyLin(1.,-val);
3821 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3822 ret2->setArray(ret);
3827 if(!self->getArray())
3828 throw INTERP_KERNEL::Exception(msg2);
3829 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
3830 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3831 ret2->setArray(ret);
3836 if(!self->getArray())
3837 throw INTERP_KERNEL::Exception(msg2);
3838 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3839 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3840 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3841 ret2->setArray(ret);
3846 if(!self->getArray())
3847 throw INTERP_KERNEL::Exception(msg2);
3848 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3849 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3850 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3851 ret2->setArray(ret);
3855 { throw INTERP_KERNEL::Exception(msg); }
3859 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3861 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
3864 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3866 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
3869 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3871 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
3874 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3876 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.";
3877 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
3880 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3882 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3884 return (*self)/(*other);
3886 throw INTERP_KERNEL::Exception(msg);
3891 DataArrayDoubleTuple *aa;
3892 std::vector<double> bb;
3894 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3900 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
3901 if(!self->getArray())
3902 throw INTERP_KERNEL::Exception(msg2);
3903 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3904 ret->applyLin(1./val,0);
3905 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3906 ret2->setArray(ret);
3911 if(!self->getArray())
3912 throw INTERP_KERNEL::Exception(msg2);
3913 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
3914 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3915 ret2->setArray(ret);
3920 if(!self->getArray())
3921 throw INTERP_KERNEL::Exception(msg2);
3922 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3923 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
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=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3933 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3934 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3935 ret2->setArray(ret);
3939 { throw INTERP_KERNEL::Exception(msg); }
3943 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3945 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
3948 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3950 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.";
3951 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
3954 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3956 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3958 return (*self)^(*other);
3960 throw INTERP_KERNEL::Exception(msg);
3965 DataArrayDoubleTuple *aa;
3966 std::vector<double> bb;
3968 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3973 if(!self->getArray())
3974 throw INTERP_KERNEL::Exception(msg2);
3975 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3977 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3978 ret2->setArray(ret);
3983 if(!self->getArray())
3984 throw INTERP_KERNEL::Exception(msg2);
3985 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
3986 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3987 ret2->setArray(ret);
3992 if(!self->getArray())
3993 throw INTERP_KERNEL::Exception(msg2);
3994 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3995 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3996 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3997 ret2->setArray(ret);
4002 if(!self->getArray())
4003 throw INTERP_KERNEL::Exception(msg2);
4004 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4005 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4006 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4007 ret2->setArray(ret);
4011 { throw INTERP_KERNEL::Exception(msg); }
4015 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
4017 return self->negate();
4020 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4022 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.";
4023 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
4026 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4028 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4032 Py_XINCREF(trueSelf);
4036 throw INTERP_KERNEL::Exception(msg);
4041 DataArrayDoubleTuple *aa;
4042 std::vector<double> bb;
4044 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4049 if(!self->getArray())
4050 throw INTERP_KERNEL::Exception(msg2);
4051 self->getArray()->applyLin(1.,val);
4052 Py_XINCREF(trueSelf);
4057 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4060 Py_XINCREF(trueSelf);
4065 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4066 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4067 ret2->setArray(aaa);
4069 Py_XINCREF(trueSelf);
4074 if(!self->getArray())
4075 throw INTERP_KERNEL::Exception(msg2);
4076 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4077 self->getArray()->addEqual(aaa);
4078 Py_XINCREF(trueSelf);
4082 { throw INTERP_KERNEL::Exception(msg); }
4086 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4088 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.";
4089 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4092 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4094 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4098 Py_XINCREF(trueSelf);
4102 throw INTERP_KERNEL::Exception(msg);
4107 DataArrayDoubleTuple *aa;
4108 std::vector<double> bb;
4110 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4115 if(!self->getArray())
4116 throw INTERP_KERNEL::Exception(msg2);
4117 self->getArray()->applyLin(1.,-val);
4118 Py_XINCREF(trueSelf);
4123 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4126 Py_XINCREF(trueSelf);
4131 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4132 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4133 ret2->setArray(aaa);
4135 Py_XINCREF(trueSelf);
4140 if(!self->getArray())
4141 throw INTERP_KERNEL::Exception(msg2);
4142 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4143 self->getArray()->substractEqual(aaa);
4144 Py_XINCREF(trueSelf);
4148 { throw INTERP_KERNEL::Exception(msg); }
4152 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4154 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.";
4155 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4158 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4160 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4164 Py_XINCREF(trueSelf);
4168 throw INTERP_KERNEL::Exception(msg);
4173 DataArrayDoubleTuple *aa;
4174 std::vector<double> bb;
4176 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4181 if(!self->getArray())
4182 throw INTERP_KERNEL::Exception(msg2);
4183 self->getArray()->applyLin(val,0);
4184 Py_XINCREF(trueSelf);
4189 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4192 Py_XINCREF(trueSelf);
4197 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4198 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4199 ret2->setArray(aaa);
4201 Py_XINCREF(trueSelf);
4206 if(!self->getArray())
4207 throw INTERP_KERNEL::Exception(msg2);
4208 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4209 self->getArray()->multiplyEqual(aaa);
4210 Py_XINCREF(trueSelf);
4214 { throw INTERP_KERNEL::Exception(msg); }
4218 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4220 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.";
4221 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4224 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4226 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4230 Py_XINCREF(trueSelf);
4234 throw INTERP_KERNEL::Exception(msg);
4239 DataArrayDoubleTuple *aa;
4240 std::vector<double> bb;
4242 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4248 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4249 if(!self->getArray())
4250 throw INTERP_KERNEL::Exception(msg2);
4251 self->getArray()->applyLin(1./val,0);
4252 Py_XINCREF(trueSelf);
4257 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4260 Py_XINCREF(trueSelf);
4265 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4266 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4267 ret2->setArray(aaa);
4269 Py_XINCREF(trueSelf);
4274 if(!self->getArray())
4275 throw INTERP_KERNEL::Exception(msg2);
4276 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4277 self->getArray()->divideEqual(aaa);
4278 Py_XINCREF(trueSelf);
4282 { throw INTERP_KERNEL::Exception(msg); }
4286 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4288 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.";
4289 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4292 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4294 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4298 Py_XINCREF(trueSelf);
4302 throw INTERP_KERNEL::Exception(msg);
4307 DataArrayDoubleTuple *aa;
4308 std::vector<double> bb;
4310 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4315 if(!self->getArray())
4316 throw INTERP_KERNEL::Exception(msg2);
4317 self->getArray()->applyPow(val);
4318 Py_XINCREF(trueSelf);
4323 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4326 Py_XINCREF(trueSelf);
4331 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4332 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4333 ret2->setArray(aaa);
4335 Py_XINCREF(trueSelf);
4340 if(!self->getArray())
4341 throw INTERP_KERNEL::Exception(msg2);
4342 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4343 self->getArray()->powEqual(aaa);
4344 Py_XINCREF(trueSelf);
4348 { throw INTERP_KERNEL::Exception(msg); }
4352 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4354 std::vector<const MEDCouplingFieldDouble *> tmp;
4355 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4356 return MEDCouplingFieldDouble::MergeFields(tmp);
4359 static void WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
4361 std::vector<const MEDCouplingFieldDouble *> tmp;
4362 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4363 MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4368 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4371 int getNumberOfFields() const;
4372 MEDCouplingMultiFields *deepCpy() const;
4373 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4374 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4375 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4376 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4377 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4380 std::string __str__() const throw(INTERP_KERNEL::Exception)
4382 return self->simpleRepr();
4384 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4386 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4387 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4389 std::vector<MEDCouplingFieldDouble *> fs(sz);
4390 for(int i=0;i<sz;i++)
4391 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4392 return MEDCouplingMultiFields::New(fs);
4394 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4396 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4397 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4399 std::vector<MEDCouplingFieldDouble *> fs(sz);
4400 for(int i=0;i<sz;i++)
4401 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4402 return MEDCouplingMultiFields::New(fs);
4404 PyObject *getFields() const
4406 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4407 int sz=fields.size();
4408 PyObject *res = PyList_New(sz);
4409 for(int i=0;i<sz;i++)
4413 fields[i]->incrRef();
4414 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4418 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4423 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4425 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4429 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4432 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4434 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4436 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4438 PyObject *res = PyList_New(sz);
4439 for(int i=0;i<sz;i++)
4444 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4448 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4453 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4455 std::vector<int> refs;
4456 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4458 PyObject *res = PyList_New(sz);
4459 for(int i=0;i<sz;i++)
4464 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4468 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4472 PyObject *ret=PyTuple_New(2);
4473 PyTuple_SetItem(ret,0,res);
4474 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4477 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4479 std::vector<DataArrayDouble *> ms=self->getArrays();
4481 PyObject *res = PyList_New(sz);
4482 for(int i=0;i<sz;i++)
4487 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4491 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4496 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4498 std::vector< std::vector<int> > refs;
4499 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4501 PyObject *res = PyList_New(sz);
4502 PyObject *res2 = PyList_New(sz);
4503 for(int i=0;i<sz;i++)
4508 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4512 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4514 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4517 PyObject *ret=PyTuple_New(2);
4518 PyTuple_SetItem(ret,0,res);
4519 PyTuple_SetItem(ret,1,res2);
4525 class MEDCouplingDefinitionTime
4528 MEDCouplingDefinitionTime();
4529 void assign(const MEDCouplingDefinitionTime& other);
4530 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4531 double getTimeResolution() const;
4532 std::vector<double> getHotSpotsTime() const;
4535 std::string __str__() const throw(INTERP_KERNEL::Exception)
4537 std::ostringstream oss;
4538 self->appendRepr(oss);
4542 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4544 int meshId,arrId,arrIdInField,fieldId;
4545 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4546 PyObject *res=PyList_New(4);
4547 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4548 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4549 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4550 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4554 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4556 int meshId,arrId,arrIdInField,fieldId;
4557 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4558 PyObject *res=PyList_New(4);
4559 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4560 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4561 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4562 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4568 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4571 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4572 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4576 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4578 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4579 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4581 std::vector<MEDCouplingFieldDouble *> fs(sz);
4582 for(int i=0;i<sz;i++)
4583 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4584 return MEDCouplingFieldOverTime::New(fs);
4586 std::string __str__() const throw(INTERP_KERNEL::Exception)
4588 return self->simpleRepr();
4590 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4592 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4593 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4595 std::vector<MEDCouplingFieldDouble *> fs(sz);
4596 for(int i=0;i<sz;i++)
4597 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4598 return MEDCouplingFieldOverTime::New(fs);
4603 class MEDCouplingCartesianAMRMesh;
4605 class MEDCouplingCartesianAMRPatch : public RefCountObject
4608 int getNumberOfCellsRecursiveWithOverlap() const throw(INTERP_KERNEL::Exception);
4609 int getNumberOfCellsRecursiveWithoutOverlap() const throw(INTERP_KERNEL::Exception);
4610 int getMaxNumberOfLevelsRelativeToThis() const throw(INTERP_KERNEL::Exception);
4611 int getNumberOfOverlapedCellsForFather() const throw(INTERP_KERNEL::Exception);
4614 PyObject *getBLTRRange() const throw(INTERP_KERNEL::Exception)
4616 const std::vector< std::pair<int,int> >& ret(self->getBLTRRange());
4617 return convertFromVectorPairInt(ret);
4620 MEDCouplingCartesianAMRMesh *getMesh() const throw(INTERP_KERNEL::Exception)
4622 MEDCouplingCartesianAMRMesh *ret(const_cast<MEDCouplingCartesianAMRMesh *>(self->getMesh()));
4628 void addPatch(PyObject *bottomLeftTopRight, int factor) throw(INTERP_KERNEL::Exception)
4630 std::vector< std::pair<int,int> > inp;
4631 convertPyToVectorPairInt(bottomLeftTopRight,inp);
4632 self->addPatch(inp,factor);
4635 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const throw(INTERP_KERNEL::Exception)
4637 const MEDCouplingCartesianAMRMesh *mesh(self->getMesh());
4639 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__getitem__ : no underlying mesh !");
4640 if(patchId==mesh->getNumberOfPatches())
4642 std::ostringstream oss;
4643 oss << "Requesting for patchId " << patchId << " having only " << mesh->getNumberOfPatches() << " patches !";
4644 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4647 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(mesh->getPatch(patchId)));
4653 void __delitem__(int patchId) throw(INTERP_KERNEL::Exception)
4655 MEDCouplingCartesianAMRMesh *mesh(const_cast<MEDCouplingCartesianAMRMesh *>(self->getMesh()));
4657 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__delitem__ : no underlying mesh !");
4658 mesh->removePatch(patchId);
4661 int __len__() const throw(INTERP_KERNEL::Exception)
4663 const MEDCouplingCartesianAMRMesh *mesh(self->getMesh());
4665 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__len__ : no underlying mesh !");
4666 return mesh->getNumberOfPatches();
4671 class MEDCouplingCartesianAMRMesh : public RefCountObject, public TimeLabel
4675 int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
4676 int getMaxNumberOfLevelsRelativeToThis() const throw(INTERP_KERNEL::Exception);
4677 int getNumberOfCellsAtCurrentLevel() const throw(INTERP_KERNEL::Exception);
4678 int getNumberOfCellsRecursiveWithOverlap() const throw(INTERP_KERNEL::Exception);
4679 int getNumberOfCellsRecursiveWithoutOverlap() const throw(INTERP_KERNEL::Exception);
4681 int getNumberOfPatches() const throw(INTERP_KERNEL::Exception);
4682 MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
4683 void removePatch(int patchId) throw(INTERP_KERNEL::Exception);
4684 void detachFromFather() throw(INTERP_KERNEL::Exception);
4687 static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
4689 static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !";
4690 static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !";
4691 const int *nodeStrctPtr(0);
4692 const double *originPtr(0),*dxyzPtr(0);
4694 std::vector<int> bb0;
4695 nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
4698 std::vector<double> bb,bb2;
4700 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
4701 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
4703 return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
4706 MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
4708 return ParaMEDMEM_MEDCouplingCartesianAMRMesh_New(meshName,spaceDim,nodeStrct,origin,dxyz);
4711 void addPatch(PyObject *bottomLeftTopRight, int factor) throw(INTERP_KERNEL::Exception)
4713 std::vector< std::pair<int,int> > inp;
4714 convertPyToVectorPairInt(bottomLeftTopRight,inp);
4715 self->addPatch(inp,factor);
4718 MEDCouplingCartesianAMRMesh *getFather() const throw(INTERP_KERNEL::Exception)
4720 MEDCouplingCartesianAMRMesh *ret(const_cast<MEDCouplingCartesianAMRMesh *>(self->getFather()));
4726 MEDCouplingCartesianAMRMesh *getGodFather() const throw(INTERP_KERNEL::Exception)
4728 MEDCouplingCartesianAMRMesh *ret(const_cast<MEDCouplingCartesianAMRMesh *>(self->getGodFather()));
4734 MEDCouplingCartesianAMRPatch *getPatch(int patchId) const throw(INTERP_KERNEL::Exception)
4736 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
4742 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const throw(INTERP_KERNEL::Exception)
4744 if(patchId==self->getNumberOfPatches())
4746 std::ostringstream oss;
4747 oss << "Requesting for patchId " << patchId << " having only " << self->getNumberOfPatches() << " patches !";
4748 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4751 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
4757 void __delitem__(int patchId) throw(INTERP_KERNEL::Exception)
4759 self->removePatch(patchId);
4762 int __len__() const throw(INTERP_KERNEL::Exception)
4764 return self->getNumberOfPatches();
4769 class DenseMatrix : public RefCountObject, public TimeLabel
4772 static DenseMatrix *New(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
4773 static DenseMatrix *New(DataArrayDouble *array, int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
4774 DenseMatrix *deepCpy() const throw(INTERP_KERNEL::Exception);
4775 DenseMatrix *shallowCpy() const throw(INTERP_KERNEL::Exception);
4777 int getNumberOfRows() const throw(INTERP_KERNEL::Exception);
4778 int getNumberOfCols() const throw(INTERP_KERNEL::Exception);
4779 int getNbOfElems() const throw(INTERP_KERNEL::Exception);
4780 void reBuild(DataArrayDouble *array, int nbRows=-1, int nbCols=-1) throw(INTERP_KERNEL::Exception);
4781 void reShape(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
4782 void transpose() throw(INTERP_KERNEL::Exception);
4784 bool isEqual(const DenseMatrix& other, double eps) const throw(INTERP_KERNEL::Exception);
4785 DataArrayDouble *matVecMult(const DataArrayDouble *vec) const throw(INTERP_KERNEL::Exception);
4786 static DataArrayDouble *MatVecMult(const DenseMatrix *mat, const DataArrayDouble *vec) throw(INTERP_KERNEL::Exception);
4789 DenseMatrix(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception)
4791 return DenseMatrix::New(nbRows,nbCols);
4794 DenseMatrix(DataArrayDouble *array, int nbRows, int nbCols) throw(INTERP_KERNEL::Exception)
4796 return DenseMatrix::New(array,nbRows,nbCols);
4799 PyObject *isEqualIfNotWhy(const DenseMatrix& other, double eps) const throw(INTERP_KERNEL::Exception)
4802 bool ret0=self->isEqualIfNotWhy(other,eps,ret1);
4803 PyObject *ret=PyTuple_New(2);
4804 PyObject *ret0Py=ret0?Py_True:Py_False;
4806 PyTuple_SetItem(ret,0,ret0Py);
4807 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4811 DataArrayDouble *getData() throw(INTERP_KERNEL::Exception)
4813 DataArrayDouble *ret(self->getData());
4819 DenseMatrix *__add__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
4821 return ParaMEDMEM::DenseMatrix::Add(self,other);
4824 DenseMatrix *__sub__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
4826 return ParaMEDMEM::DenseMatrix::Substract(self,other);
4829 DenseMatrix *__mul__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
4831 return ParaMEDMEM::DenseMatrix::Multiply(self,other);
4834 DenseMatrix *__mul__(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception)
4836 return ParaMEDMEM::DenseMatrix::Multiply(self,other);
4839 PyObject *___iadd___(PyObject *trueSelf, const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
4841 self->addEqual(other);
4842 Py_XINCREF(trueSelf);
4846 PyObject *___isub___(PyObject *trueSelf, const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
4848 self->substractEqual(other);
4849 Py_XINCREF(trueSelf);
4858 __filename=os.environ.get('PYTHONSTARTUP')
4859 if __filename and os.path.isfile(__filename):
4860 execfile(__filename)