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 "MEDCouplingCurveLinearMesh.hxx"
32 #include "MEDCoupling1GTUMesh.hxx"
33 #include "MEDCouplingField.hxx"
34 #include "MEDCouplingFieldDouble.hxx"
35 #include "MEDCouplingFieldTemplate.hxx"
36 #include "MEDCouplingGaussLocalization.hxx"
37 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
38 #include "MEDCouplingMultiFields.hxx"
39 #include "MEDCouplingFieldOverTime.hxx"
40 #include "MEDCouplingDefinitionTime.hxx"
41 #include "MEDCouplingFieldDiscretization.hxx"
42 #include "MEDCouplingTypemaps.i"
44 #include "InterpKernelAutoPtr.hxx"
46 using namespace ParaMEDMEM;
47 using namespace INTERP_KERNEL;
51 %template(ivec) std::vector<int>;
52 %template(dvec) std::vector<double>;
53 %template(svec) std::vector<std::string>;
56 %typemap(out) ParaMEDMEM::MEDCouplingMesh*
58 $result=convertMesh($1,$owner);
61 %typemap(out) MEDCouplingMesh*
63 $result=convertMesh($1,$owner);
68 %typemap(out) ParaMEDMEM::MEDCouplingPointSet*
70 $result=convertMesh($1,$owner);
73 %typemap(out) MEDCouplingPointSet*
75 $result=convertMesh($1,$owner);
81 %typemap(out) ParaMEDMEM::MEDCoupling1GTUMesh*
83 $result=convertMesh($1,$owner);
86 %typemap(out) MEDCoupling1GTUMesh*
88 $result=convertMesh($1,$owner);
93 %typemap(out) ParaMEDMEM::MEDCouplingStructuredMesh*
95 $result=convertMesh($1,$owner);
98 %typemap(out) MEDCouplingStructuredMesh*
100 $result=convertMesh($1,$owner);
105 %typemap(out) ParaMEDMEM::MEDCouplingFieldDiscretization*
107 $result=convertFieldDiscretization($1,$owner);
110 %typemap(out) MEDCouplingFieldDiscretization*
112 $result=convertFieldDiscretization($1,$owner);
117 %typemap(out) ParaMEDMEM::MEDCouplingMultiFields*
119 $result=convertMultiFields($1,$owner);
122 %typemap(out) MEDCouplingMultiFields*
124 $result=convertMultiFields($1,$owner);
129 %init %{ import_array(); %}
132 %feature("autodoc", "1");
133 %feature("docstring");
135 %newobject ParaMEDMEM::MEDCouplingField::buildMeasureField;
136 %newobject ParaMEDMEM::MEDCouplingField::getLocalizationOfDiscr;
137 %newobject ParaMEDMEM::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
138 %newobject ParaMEDMEM::MEDCouplingFieldDouble::New;
139 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getArray;
140 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getEndArray;
141 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MergeFields;
142 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MeldFields;
143 %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct;
144 %newobject ParaMEDMEM::MEDCouplingFieldDouble::determinant;
145 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenValues;
146 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenVectors;
147 %newobject ParaMEDMEM::MEDCouplingFieldDouble::inverse;
148 %newobject ParaMEDMEM::MEDCouplingFieldDouble::trace;
149 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deviator;
150 %newobject ParaMEDMEM::MEDCouplingFieldDouble::magnitude;
151 %newobject ParaMEDMEM::MEDCouplingFieldDouble::maxPerTuple;
152 %newobject ParaMEDMEM::MEDCouplingFieldDouble::keepSelectedComponents;
153 %newobject ParaMEDMEM::MEDCouplingFieldDouble::extractSlice3D;
154 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DotFields;
155 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dot;
156 %newobject ParaMEDMEM::MEDCouplingFieldDouble::CrossProductFields;
157 %newobject ParaMEDMEM::MEDCouplingFieldDouble::crossProduct;
158 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MaxFields;
159 %newobject ParaMEDMEM::MEDCouplingFieldDouble::max;
160 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MinFields;
161 %newobject ParaMEDMEM::MEDCouplingFieldDouble::AddFields;
162 %newobject ParaMEDMEM::MEDCouplingFieldDouble::SubstractFields;
163 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MultiplyFields;
164 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DivideFields;
165 %newobject ParaMEDMEM::MEDCouplingFieldDouble::min;
166 %newobject ParaMEDMEM::MEDCouplingFieldDouble::negate;
167 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getIdsInRange;
168 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart;
169 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPartRange;
170 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__getitem__;
171 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__neg__;
172 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__add__;
173 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__sub__;
174 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__mul__;
175 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__div__;
176 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__pow__;
177 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__radd__;
178 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rsub__;
179 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rmul__;
180 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rdiv__;
181 %newobject ParaMEDMEM::MEDCouplingFieldDouble::clone;
182 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cloneWithMesh;
183 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy;
184 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
185 %newobject ParaMEDMEM::MEDCouplingFieldDouble::nodeToCellDiscretization;
186 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cellToNodeDiscretization;
187 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
188 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
189 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
190 %newobject ParaMEDMEM::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
191 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
192 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfNodesPerCell;
193 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfFacesPerCell;
194 %newobject ParaMEDMEM::MEDCouplingMesh::computeEffectiveNbOfNodesPerCell;
195 %newobject ParaMEDMEM::MEDCouplingMesh::buildPartRange;
196 %newobject ParaMEDMEM::MEDCouplingMesh::giveCellsWithType;
197 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
198 %newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
199 %newobject ParaMEDMEM::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
200 %newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
201 %newobject ParaMEDMEM::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
202 %newobject ParaMEDMEM::MEDCouplingMesh::mergeMyselfWith;
203 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic;
204 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic2;
205 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic3;
206 %newobject ParaMEDMEM::MEDCouplingMesh::getMeasureField;
207 %newobject ParaMEDMEM::MEDCouplingMesh::simplexize;
208 %newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured;
209 %newobject ParaMEDMEM::MEDCouplingMesh::MergeMeshes;
210 %newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer;
211 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellsInBoundingBox;
212 %newobject ParaMEDMEM::MEDCouplingPointSet::findBoundaryNodes;
213 %newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh;
214 %newobject ParaMEDMEM::MEDCouplingPointSet::MergeNodesArray;
215 %newobject ParaMEDMEM::MEDCouplingPointSet::buildPartOfMySelf2;
216 %newobject ParaMEDMEM::MEDCouplingPointSet::BuildInstanceFromMeshType;
217 %newobject ParaMEDMEM::MEDCouplingPointSet::zipConnectivityTraducer;
218 %newobject ParaMEDMEM::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
219 %newobject ParaMEDMEM::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
220 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellIdsLyingOnNodes;
221 %newobject ParaMEDMEM::MEDCouplingPointSet::deepCpyConnectivityOnly;
222 %newobject ParaMEDMEM::MEDCouplingPointSet::getBoundingBoxForBBTree;
223 %newobject ParaMEDMEM::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells;
224 %newobject ParaMEDMEM::MEDCouplingPointSet::__getitem__;
225 %newobject ParaMEDMEM::MEDCouplingUMesh::New;
226 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
227 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
228 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
229 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
230 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
231 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
232 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
233 %newobject ParaMEDMEM::MEDCouplingUMesh::explode3DMeshTo1D;
234 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
235 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
236 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
237 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
238 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
239 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
240 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
241 %newobject ParaMEDMEM::MEDCouplingUMesh::conformize2D;
242 %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
243 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
244 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
245 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
246 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
247 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
248 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
249 %newobject ParaMEDMEM::MEDCouplingUMesh::convertLinearCellsToQuadratic;
250 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
251 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
252 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
253 %newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField;
254 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner;
255 %newobject ParaMEDMEM::MEDCouplingUMesh::computePlaneEquationOf3DFaces;
256 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField;
257 %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
258 %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
259 %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
260 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
261 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
262 %newobject ParaMEDMEM::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
263 %newobject ParaMEDMEM::MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh;
264 %newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
265 %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
266 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis;
267 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsCrossingPlane;
268 %newobject ParaMEDMEM::MEDCouplingUMesh::convexEnvelop2D;
269 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
270 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf2DMesh;
271 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf3DMesh;
272 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
273 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
274 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic;
275 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
276 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
277 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::New;
278 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::getNodalConnectivity;
279 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
280 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::New;
281 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
282 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::computeDualMesh;
283 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
284 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::sortHexa8EachOther;
285 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
286 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
287 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::New;
288 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
289 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
290 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
291 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
292 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
293 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
294 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::buildStructuredSubPart;
295 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTUnstructured;
296 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTSubLevelMesh;
297 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
298 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
299 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh;
300 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
301 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
302 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
303 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
304 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
305 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
306 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
307 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
308 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
310 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
311 %feature("unref") MEDCouplingMesh "$this->decrRef();"
312 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
313 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
314 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
315 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
316 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
317 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
318 %feature("unref") MEDCouplingField "$this->decrRef();"
319 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
320 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
321 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
322 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
323 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
324 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
325 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
326 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
327 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
329 %rename(assign) *::operator=;
330 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
331 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
332 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
333 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
337 %rename (InterpKernelException) INTERP_KERNEL::Exception;
339 %include "MEDCouplingRefCountObject.i"
340 %include "MEDCouplingMemArray.i"
358 CONST_ON_TIME_INTERVAL = 7
359 } TypeOfTimeDiscretization;
367 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
368 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11
369 } MEDCouplingMeshType;
372 class DataArrayDouble;
373 class MEDCouplingUMesh;
374 class MEDCouplingFieldDouble;
376 %extend RefCountObject
378 std::string getHiddenCppPointer() const
380 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
385 %extend MEDCouplingGaussLocalization
387 std::string __str__() const throw(INTERP_KERNEL::Exception)
389 return self->getStringRepr();
392 std::string __repr__() const throw(INTERP_KERNEL::Exception)
394 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
395 oss << self->getStringRepr();
402 class MEDCouplingMesh : public RefCountObject, public TimeLabel
405 void setName(const std::string& name);
406 std::string getName() const;
407 void setDescription(const std::string& descr);
408 std::string getDescription() const;
409 void setTime(double val, int iteration, int order);
410 void setTimeUnit(const std::string& unit);
411 std::string getTimeUnit() const;
412 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
413 bool isStructured() const throw(INTERP_KERNEL::Exception);
414 virtual MEDCouplingMesh *deepCpy() const;
415 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
416 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
417 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
418 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
419 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
420 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
421 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
422 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
423 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
424 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
425 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
426 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
427 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
428 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
429 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
430 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
431 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
432 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
433 virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
434 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
435 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
436 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
437 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
438 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
439 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
441 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
442 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
443 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
444 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
445 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception);
446 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
447 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
448 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
449 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
450 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
451 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
452 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
453 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
454 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
455 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
456 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
457 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
460 std::string __str__() const throw(INTERP_KERNEL::Exception)
462 return self->simpleRepr();
465 PyObject *getTime() throw(INTERP_KERNEL::Exception)
468 double tmp0=self->getTime(tmp1,tmp2);
469 PyObject *res = PyList_New(3);
470 PyList_SetItem(res,0,SWIG_From_double(tmp0));
471 PyList_SetItem(res,1,SWIG_From_int(tmp1));
472 PyList_SetItem(res,2,SWIG_From_int(tmp2));
476 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
480 DataArrayDoubleTuple *aa;
481 std::vector<double> bb;
483 int spaceDim=self->getSpaceDimension();
484 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
485 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
486 return self->getCellContainingPoint(pos,eps);
489 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
493 DataArrayDoubleTuple *aa;
494 std::vector<double> bb;
496 int spaceDim=self->getSpaceDimension();
497 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
498 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
499 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
500 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
501 PyObject *ret=PyTuple_New(2);
502 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
503 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
507 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
509 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
510 int spaceDim=self->getSpaceDimension();
512 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
513 if (!SWIG_IsOK(res1))
516 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
517 int nbOfPoints=size/spaceDim;
520 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
522 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
526 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
528 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
529 da2->checkAllocated();
530 int size=da2->getNumberOfTuples();
531 int nbOfCompo=da2->getNumberOfComponents();
532 if(nbOfCompo!=spaceDim)
534 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
536 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
538 PyObject *ret=PyTuple_New(2);
539 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
540 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
544 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
548 DataArrayDoubleTuple *aa;
549 std::vector<double> bb;
551 int spaceDim=self->getSpaceDimension();
552 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
553 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
554 std::vector<int> elts;
555 self->getCellsContainingPoint(pos,eps,elts);
556 DataArrayInt *ret=DataArrayInt::New();
557 ret->alloc((int)elts.size(),1);
558 std::copy(elts.begin(),elts.end(),ret->getPointer());
559 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
562 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
564 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
565 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
566 self->getReverseNodalConnectivity(d0,d1);
567 PyObject *ret=PyTuple_New(2);
568 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
569 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
573 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
576 int v0; std::vector<int> v1;
577 const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
578 self->renumberCells(ids,check);
581 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
583 DataArrayInt *cellCor, *nodeCor;
584 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
585 PyObject *res = PyList_New(2);
586 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
587 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
591 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
593 DataArrayInt *cellCor=0,*nodeCor=0;
594 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
595 PyObject *res = PyList_New(2);
596 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
597 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
601 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
603 DataArrayInt *cellCor=0;
604 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
608 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
611 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
612 if (!SWIG_IsOK(res1))
615 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
616 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
620 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
622 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
623 da2->checkAllocated();
624 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
627 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
629 std::vector<int> conn;
630 self->getNodeIdsOfCell(cellId,conn);
631 return convertIntArrToPyList2(conn);
634 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
636 std::vector<double> coo;
637 self->getCoordinatesOfNode(nodeId,coo);
638 return convertDblArrToPyList2(coo);
641 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
645 DataArrayDoubleTuple *aa;
646 std::vector<double> bb;
648 int spaceDim=self->getSpaceDimension();
649 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
650 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
651 self->scale(pointPtr,factor);
654 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
656 int spaceDim=self->getSpaceDimension();
657 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
658 self->getBoundingBox(tmp);
659 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
663 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
666 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
667 PyObject *ret=PyTuple_New(2);
668 PyObject *ret0Py=ret0?Py_True:Py_False;
670 PyTuple_SetItem(ret,0,ret0Py);
671 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
675 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
677 int szArr,sw,iTypppArr;
678 std::vector<int> stdvecTyyppArr;
679 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
680 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
681 if(sw==3)//DataArrayInt
683 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
684 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
685 std::string name=argpt->getName();
687 ret->setName(name.c_str());
689 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
692 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
694 int szArr,sw,iTypppArr;
695 std::vector<int> stdvecTyyppArr;
697 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
698 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
699 if(sw==3)//DataArrayInt
701 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
702 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
703 std::string name=argpt->getName();
705 ret->setName(name.c_str());
708 PyObject *res = PyList_New(2);
709 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
710 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
711 PyList_SetItem(res,0,obj0);
712 PyList_SetItem(res,1,obj1);
716 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
720 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
721 PyObject *res = PyTuple_New(2);
722 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
725 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
727 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
728 PyTuple_SetItem(res,0,obj0);
729 PyTuple_SetItem(res,1,obj1);
733 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
735 std::vector<int> vals=self->getDistributionOfTypes();
737 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
738 PyObject *ret=PyList_New((int)vals.size()/3);
739 for(int j=0;j<(int)vals.size()/3;j++)
741 PyObject *ret1=PyList_New(3);
742 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
743 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
744 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
745 PyList_SetItem(ret,j,ret1);
750 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
752 std::vector<int> code;
753 std::vector<const DataArrayInt *> idsPerType;
754 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
755 convertPyToNewIntArr4(li,1,3,code);
756 return self->checkTypeConsistencyAndContig(code,idsPerType);
759 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
761 std::vector<int> code;
762 std::vector<DataArrayInt *> idsInPflPerType;
763 std::vector<DataArrayInt *> idsPerType;
764 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
765 PyObject *ret=PyTuple_New(3);
768 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
769 PyObject *ret0=PyList_New((int)code.size()/3);
770 for(int j=0;j<(int)code.size()/3;j++)
772 PyObject *ret00=PyList_New(3);
773 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
774 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
775 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
776 PyList_SetItem(ret0,j,ret00);
778 PyTuple_SetItem(ret,0,ret0);
780 PyObject *ret1=PyList_New(idsInPflPerType.size());
781 for(std::size_t j=0;j<idsInPflPerType.size();j++)
782 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
783 PyTuple_SetItem(ret,1,ret1);
784 int n=idsPerType.size();
785 PyObject *ret2=PyList_New(n);
787 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
788 PyTuple_SetItem(ret,2,ret2);
792 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
796 DataArrayDoubleTuple *aa;
797 std::vector<double> bb;
799 int spaceDim=self->getSpaceDimension();
800 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
801 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
802 self->translate(vectorPtr);
805 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
807 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
810 DataArrayDoubleTuple *aa;
811 std::vector<double> bb;
813 int spaceDim=self->getSpaceDimension();
814 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
815 self->rotate(centerPtr,0,alpha);
818 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
820 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
822 DataArrayDouble *a,*a2;
823 DataArrayDoubleTuple *aa,*aa2;
824 std::vector<double> bb,bb2;
826 int spaceDim=self->getSpaceDimension();
827 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
828 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
829 self->rotate(centerPtr,vectorPtr,alpha);
832 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
834 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
835 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
836 PyObject *res=PyList_New(result.size());
837 for(int i=0;iL!=result.end(); i++, iL++)
838 PyList_SetItem(res,i,PyInt_FromLong(*iL));
842 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
844 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
845 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
846 return MEDCouplingMesh::MergeMeshes(tmp);
852 //== MEDCouplingMesh End
854 %include "NormalizedGeometricTypes"
855 %include "MEDCouplingNatureOfFieldEnum"
859 class MEDCouplingNatureOfField
862 static const char *GetRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception);
863 static std::string GetReprNoThrow(NatureOfField nat);
864 static std::string GetAllPossibilitiesStr();
868 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
869 // include "MEDCouplingTimeDiscretization.i"
873 class MEDCouplingGaussLocalization
876 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
877 const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
878 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
879 INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
880 void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
881 int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
882 int getDimension() const throw(INTERP_KERNEL::Exception);
883 int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
884 std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
885 void checkCoherency() const throw(INTERP_KERNEL::Exception);
886 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception);
888 const std::vector<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
889 double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
890 const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
891 double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
892 const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
893 double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
894 void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
895 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
896 void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
897 void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
898 void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
899 void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
901 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
905 %include "MEDCouplingFieldDiscretization.i"
907 //== MEDCouplingPointSet
911 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
914 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
915 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
916 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
917 void zipCoords() throw(INTERP_KERNEL::Exception);
918 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
919 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
920 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
921 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
922 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
923 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
924 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
925 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
926 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
927 static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception);
928 virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
929 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
930 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
931 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
932 virtual DataArrayInt *findBoundaryNodes() const;
933 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
934 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
935 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
936 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
937 virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
938 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
941 std::string __str__() const throw(INTERP_KERNEL::Exception)
943 return self->simpleRepr();
946 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
949 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
950 PyObject *res = PyList_New(2);
951 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
952 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
956 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
958 DataArrayInt *comm, *commIndex;
959 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
960 PyObject *res = PyList_New(2);
961 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
962 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
966 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
968 DataArrayDouble *ret1=self->getCoords();
971 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
974 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
976 int szArr,sw,iTypppArr;
977 std::vector<int> stdvecTyyppArr;
978 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
979 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
980 if(sw==3)//DataArrayInt
982 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
983 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
984 std::string name=argpt->getName();
986 ret->setName(name.c_str());
988 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
991 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
993 int szArr,sw,iTypppArr;
994 std::vector<int> stdvecTyyppArr;
995 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
996 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
997 if(sw==3)//DataArrayInt
999 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1000 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1001 std::string name=argpt->getName();
1003 ret->setName(name.c_str());
1005 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1008 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
1010 int szArr,sw,iTypppArr;
1011 std::vector<int> stdvecTyyppArr;
1012 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1013 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1014 if(sw==3)//DataArrayInt
1016 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1017 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1018 std::string name=argpt->getName();
1020 ret->setName(name.c_str());
1022 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1025 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1027 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1028 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1031 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1033 int szArr,sw,iTypppArr;
1034 std::vector<int> stdvecTyyppArr;
1035 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1036 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1037 if(sw==3)//DataArrayInt
1039 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1040 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1041 std::string name=argpt->getName();
1043 ret->setName(name.c_str());
1045 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1048 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1050 int szArr,sw,iTypppArr;
1051 std::vector<int> stdvecTyyppArr;
1052 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1053 self->renumberNodes(tmp,newNbOfNodes);
1056 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1058 int szArr,sw,iTypppArr;
1059 std::vector<int> stdvecTyyppArr;
1060 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1061 self->renumberNodes2(tmp,newNbOfNodes);
1064 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1066 int spaceDim=self->getSpaceDimension();
1068 DataArrayDouble *a,*a2;
1069 DataArrayDoubleTuple *aa,*aa2;
1070 std::vector<double> bb,bb2;
1072 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1073 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1074 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1075 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1076 std::vector<int> nodes;
1077 self->findNodesOnLine(p,v,eps,nodes);
1078 DataArrayInt *ret=DataArrayInt::New();
1079 ret->alloc((int)nodes.size(),1);
1080 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1081 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1083 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1085 int spaceDim=self->getSpaceDimension();
1087 DataArrayDouble *a,*a2;
1088 DataArrayDoubleTuple *aa,*aa2;
1089 std::vector<double> bb,bb2;
1091 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1092 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1093 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1094 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1095 std::vector<int> nodes;
1096 self->findNodesOnPlane(p,v,eps,nodes);
1097 DataArrayInt *ret=DataArrayInt::New();
1098 ret->alloc((int)nodes.size(),1);
1099 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1100 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1103 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1107 DataArrayDoubleTuple *aa;
1108 std::vector<double> bb;
1110 int spaceDim=self->getSpaceDimension();
1111 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1112 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1113 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1114 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1117 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1119 DataArrayInt *c=0,*cI=0;
1123 DataArrayDoubleTuple *aa;
1124 std::vector<double> bb;
1126 int spaceDim=self->getSpaceDimension();
1127 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1128 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1129 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1130 PyObject *ret=PyTuple_New(2);
1131 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1132 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1136 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1138 DataArrayInt *c=0,*cI=0;
1139 int spaceDim=self->getSpaceDimension();
1142 DataArrayDoubleTuple *aa;
1143 std::vector<double> bb;
1146 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1147 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1149 PyObject *ret=PyTuple_New(2);
1150 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1151 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1155 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1159 DataArrayDoubleTuple *aa;
1160 std::vector<double> bb;
1162 int spaceDim=self->getSpaceDimension();
1163 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1164 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1166 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1167 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1170 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1174 std::vector<int> multiVal;
1175 std::pair<int, std::pair<int,int> > slic;
1176 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1177 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1181 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1183 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1185 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1187 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1191 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1193 DataArrayInt *v0=0,*v1=0;
1194 self->findCommonCells(compType,startCellId,v0,v1);
1195 PyObject *res = PyList_New(2);
1196 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1197 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1202 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1205 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1206 if (!SWIG_IsOK(res1))
1209 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1210 self->renumberNodesInConn(tmp);
1214 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1216 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1217 da2->checkAllocated();
1218 self->renumberNodesInConn(da2->getConstPointer());
1222 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1225 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1226 PyObject *ret=PyTuple_New(2);
1227 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1228 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1232 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1234 DataArrayInt *ret=0;
1236 int szArr,sw,iTypppArr;
1237 std::vector<int> stdvecTyyppArr;
1238 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1239 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1243 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1247 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1248 PyObject *res = PyList_New(3);
1249 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1250 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1251 PyList_SetItem(res,2,SWIG_From_int(ret2));
1255 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1259 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1260 PyObject *res = PyList_New(3);
1261 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1262 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1263 PyList_SetItem(res,2,SWIG_From_int(ret2));
1267 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1270 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1271 if (!SWIG_IsOK(res1))
1274 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1275 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1279 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1281 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1282 da2->checkAllocated();
1283 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1287 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1291 std::vector<int> multiVal;
1292 std::pair<int, std::pair<int,int> > slic;
1293 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1294 int nbc=self->getNumberOfCells();
1295 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1302 std::ostringstream oss;
1303 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1304 throw INTERP_KERNEL::Exception(oss.str().c_str());
1307 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1312 int tmp=nbc+singleVal;
1313 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1317 std::ostringstream oss;
1318 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1319 throw INTERP_KERNEL::Exception(oss.str().c_str());
1325 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1329 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1334 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1335 daIntTyypp->checkAllocated();
1336 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1339 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1343 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1346 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1347 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1348 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1349 for(int i=0;i<sz;i++)
1350 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1353 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1356 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1358 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1359 std::vector<double> val3;
1360 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1361 "Rotate2DAlg",2,true,nbNodes);
1363 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1364 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1367 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1370 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1371 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1372 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1373 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1374 for(int i=0;i<sz;i++)
1375 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1378 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1381 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1383 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1384 std::vector<double> val3;
1385 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1386 "Rotate3DAlg",3,true,nbNodes);
1388 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1389 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1390 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1395 //== MEDCouplingPointSet End
1397 class MEDCouplingUMeshCell
1400 INTERP_KERNEL::NormalizedCellType getType() const;
1403 std::string __str__() const throw(INTERP_KERNEL::Exception)
1405 return self->repr();
1408 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1411 const int *r=self->getAllConn(ret2);
1412 PyObject *ret=PyTuple_New(ret2);
1413 for(int i=0;i<ret2;i++)
1414 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1420 class MEDCouplingUMeshCellIterator
1427 MEDCouplingUMeshCell *ret=self->nextt();
1429 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1432 PyErr_SetString(PyExc_StopIteration,"No more data.");
1439 class MEDCouplingUMeshCellByTypeIterator
1442 ~MEDCouplingUMeshCellByTypeIterator();
1447 MEDCouplingUMeshCellEntry *ret=self->nextt();
1449 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1452 PyErr_SetString(PyExc_StopIteration,"No more data.");
1459 class MEDCouplingUMeshCellByTypeEntry
1462 ~MEDCouplingUMeshCellByTypeEntry();
1465 MEDCouplingUMeshCellByTypeIterator *__iter__()
1467 return self->iterator();
1472 class MEDCouplingUMeshCellEntry
1475 INTERP_KERNEL::NormalizedCellType getType() const;
1476 int getNumberOfElems() const;
1479 MEDCouplingUMeshCellIterator *__iter__()
1481 return self->iterator();
1486 //== MEDCouplingUMesh
1488 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1491 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1492 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1493 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1494 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1495 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1496 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1497 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1498 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1499 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1500 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1501 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1502 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1503 void computeTypes() throw(INTERP_KERNEL::Exception);
1504 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1505 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1507 DataArrayInt *conformize2D(double eps) throw(INTERP_KERNEL::Exception);
1508 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1509 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1510 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1511 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1512 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1513 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1514 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1515 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1516 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1517 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1518 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1519 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1520 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1521 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1522 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1523 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1524 bool isFullyQuadratic() const throw(INTERP_KERNEL::Exception);
1525 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1526 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1527 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1528 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1529 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1530 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1531 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1532 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1533 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1534 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1535 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1536 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1537 DataArrayDouble *computePlaneEquationOf3DFaces() const throw(INTERP_KERNEL::Exception);
1538 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1539 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1540 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1541 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1542 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1543 DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1544 DataArrayInt *buildUnionOf2DMesh() const throw(INTERP_KERNEL::Exception);
1545 DataArrayInt *buildUnionOf3DMesh() const throw(INTERP_KERNEL::Exception);
1546 DataArrayDouble *getBoundingBoxForBBTreeFast() const throw(INTERP_KERNEL::Exception);
1547 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1548 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1549 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);
1550 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1551 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1552 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1553 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1554 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1556 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1558 return MEDCouplingUMesh::New();
1561 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1563 return MEDCouplingUMesh::New(meshName,meshDim);
1566 std::string __str__() const throw(INTERP_KERNEL::Exception)
1568 return self->simpleRepr();
1571 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1573 std::ostringstream oss;
1574 self->reprQuickOverview(oss);
1578 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1580 return self->cellIterator();
1583 PyObject *getAllGeoTypesSorted() const throw(INTERP_KERNEL::Exception)
1585 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
1586 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1587 PyObject *res=PyList_New(result.size());
1588 for(int i=0;iL!=result.end(); i++, iL++)
1589 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1593 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1597 std::vector<int> multiVal;
1598 std::pair<int, std::pair<int,int> > slic;
1599 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1600 int nbc=self->getNumberOfCells();
1601 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1608 std::ostringstream oss;
1609 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1610 throw INTERP_KERNEL::Exception(oss.str().c_str());
1614 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1621 int tmp=nbc+singleVal;
1622 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1627 std::ostringstream oss;
1628 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1629 throw INTERP_KERNEL::Exception(oss.str().c_str());
1635 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1641 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1642 daIntTyypp->checkAllocated();
1643 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1647 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1651 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1655 std::vector<int> multiVal;
1656 std::pair<int, std::pair<int,int> > slic;
1657 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1658 int nbc=self->getNumberOfCells();
1659 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1666 std::ostringstream oss;
1667 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1668 throw INTERP_KERNEL::Exception(oss.str().c_str());
1672 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1679 int tmp=nbc+singleVal;
1680 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1685 std::ostringstream oss;
1686 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1687 throw INTERP_KERNEL::Exception(oss.str().c_str());
1693 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1698 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1704 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1705 daIntTyypp->checkAllocated();
1706 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1710 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1714 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1716 int szArr,sw,iTypppArr;
1717 std::vector<int> stdvecTyyppArr;
1718 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1721 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1722 throw INTERP_KERNEL::Exception(oss.str().c_str());
1724 self->insertNextCell(type,size,tmp);
1727 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1729 int szArr,sw,iTypppArr;
1730 std::vector<int> stdvecTyyppArr;
1731 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1732 self->insertNextCell(type,szArr,tmp);
1735 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1737 DataArrayInt *ret=self->getNodalConnectivity();
1742 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1744 DataArrayInt *ret=self->getNodalConnectivityIndex();
1750 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1752 int szArr,sw,iTypppArr;
1753 std::vector<int> stdvecTyyppArr;
1754 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1755 int nbOfDepthPeelingPerformed=0;
1756 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1757 PyObject *res=PyTuple_New(2);
1758 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1759 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1763 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1765 DataArrayInt *v0=0,*v1=0;
1766 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1767 PyObject *res = PyList_New(2);
1768 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1769 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1773 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1777 DataArrayDoubleTuple *aa;
1778 std::vector<double> bb;
1780 int nbOfCompo=self->getSpaceDimension();
1781 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1784 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1785 PyObject *ret=PyTuple_New(2);
1786 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1787 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1791 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1793 DataArrayInt *ret1=0;
1794 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1795 PyObject *ret=PyTuple_New(2);
1796 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1797 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1801 PyObject *tetrahedrize(int policy) throw(INTERP_KERNEL::Exception)
1804 DataArrayInt *ret1(0);
1805 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
1806 PyObject *ret=PyTuple_New(3);
1807 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
1808 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1809 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
1813 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1815 std::vector<int> cells;
1816 self->checkButterflyCells(cells,eps);
1817 DataArrayInt *ret=DataArrayInt::New();
1818 ret->alloc((int)cells.size(),1);
1819 std::copy(cells.begin(),cells.end(),ret->getPointer());
1820 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1823 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1825 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1827 PyObject *ret = PyList_New(sz);
1828 for(int i=0;i<sz;i++)
1829 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1833 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1835 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1836 int sz=retCpp.size();
1837 PyObject *ret=PyList_New(sz);
1838 for(int i=0;i<sz;i++)
1839 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1843 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1846 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1847 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1848 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1851 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1854 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1855 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1859 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1862 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1863 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1867 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1869 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1870 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1871 PyObject *ret=PyTuple_New(3);
1872 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1873 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1874 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1878 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1880 DataArrayInt *tmp0=0,*tmp1=0;
1881 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1882 PyObject *ret=PyTuple_New(2);
1883 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1884 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1888 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1892 std::vector<int> multiVal;
1893 std::pair<int, std::pair<int,int> > slic;
1894 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1895 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1899 return self->duplicateNodes(&singleVal,&singleVal+1);
1901 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
1903 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
1905 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1909 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
1913 std::vector<int> multiVal;
1914 std::pair<int, std::pair<int,int> > slic;
1915 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1916 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1920 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
1922 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
1924 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
1926 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1930 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
1933 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1934 DataArrayInt *tmp0,*tmp1=0;
1935 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
1936 PyObject *ret=PyTuple_New(2);
1937 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1938 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1942 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const throw(INTERP_KERNEL::Exception)
1944 DataArrayInt *ret0=0,*ret1=0;
1945 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
1946 PyObject *ret=PyTuple_New(2);
1947 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1948 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1952 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1954 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1955 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1956 DataArrayInt *ret1=0,*ret2=0;
1957 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
1958 PyObject *ret=PyTuple_New(3);
1959 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1960 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1961 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1965 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1967 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1968 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1969 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
1970 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1973 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
1976 std::vector<const MEDCouplingUMesh *> meshes;
1977 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1978 std::vector<DataArrayInt *> corr;
1979 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
1981 PyObject *ret1=PyList_New(sz);
1982 for(int i=0;i<sz;i++)
1983 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1984 PyObject *ret=PyList_New(2);
1985 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1986 PyList_SetItem(ret,1,ret1);
1990 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1992 std::vector<MEDCouplingUMesh *> meshes;
1993 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1994 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
1997 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
1999 std::vector<MEDCouplingUMesh *> meshes;
2000 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2001 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2004 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
2008 std::vector<int> multiVal;
2009 std::pair<int, std::pair<int,int> > slic;
2010 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2012 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2013 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2017 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2019 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2021 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2023 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2027 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2029 DataArrayInt *arrOut=0,*arrIndexOut=0;
2032 std::vector<int> multiVal;
2033 std::pair<int, std::pair<int,int> > slic;
2034 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2036 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2037 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2042 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2047 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2052 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2056 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2058 PyObject *ret=PyTuple_New(2);
2059 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2060 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2064 static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2066 DataArrayInt *arrOut=0,*arrIndexOut=0;
2067 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2068 PyObject *ret=PyTuple_New(2);
2069 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2070 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2074 static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2076 if(!PySlice_Check(slic))
2077 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !");
2078 Py_ssize_t strt=2,stp=2,step=2;
2079 PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
2081 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !");
2082 arrIndxIn->checkAllocated();
2083 if(arrIndxIn->getNumberOfComponents()!=1)
2084 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !");
2085 GetIndicesOfSlice(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !");
2086 DataArrayInt *arrOut=0,*arrIndexOut=0;
2087 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
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 *SetPartOfIndexedArrays(PyObject *li,
2095 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2096 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2098 DataArrayInt *arrOut=0,*arrIndexOut=0;
2101 std::vector<int> multiVal;
2102 std::pair<int, std::pair<int,int> > slic;
2103 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2105 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2106 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2111 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2116 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2121 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2125 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2127 PyObject *ret=PyTuple_New(2);
2128 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2129 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2133 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2134 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2138 std::vector<int> multiVal;
2139 std::pair<int, std::pair<int,int> > slic;
2140 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2142 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2143 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2148 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2153 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2158 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2162 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2166 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2170 DataArrayDoubleTuple *aa;
2171 std::vector<double> bb;
2173 int spaceDim=self->getSpaceDimension();
2174 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2175 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2177 std::vector<int> cells;
2178 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2179 DataArrayInt *ret=DataArrayInt::New();
2180 ret->alloc((int)cells.size(),1);
2181 std::copy(cells.begin(),cells.end(),ret->getPointer());
2182 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2185 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2189 DataArrayDoubleTuple *aa;
2190 std::vector<double> bb;
2192 int spaceDim=self->getSpaceDimension();
2193 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2194 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2195 self->orientCorrectly2DCells(v,polyOnly);
2198 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2200 std::vector<int> cells;
2201 self->arePolyhedronsNotCorrectlyOriented(cells);
2202 DataArrayInt *ret=DataArrayInt::New();
2203 ret->alloc((int)cells.size(),1);
2204 std::copy(cells.begin(),cells.end(),ret->getPointer());
2205 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2208 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2212 self->getFastAveragePlaneOfThis(vec,pos);
2214 std::copy(vec,vec+3,vals);
2215 std::copy(pos,pos+3,vals+3);
2216 return convertDblArrToPyListOfTuple(vals,3,2);
2219 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2221 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2222 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2223 return MEDCouplingUMesh::MergeUMeshes(tmp);
2226 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2229 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2230 PyObject *ret=PyTuple_New(2);
2231 PyObject *ret0Py=ret0?Py_True:Py_False;
2233 PyTuple_SetItem(ret,0,ret0Py);
2234 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2238 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2241 bool ret0=self->areCellsIncludedIn2(other,ret1);
2242 PyObject *ret=PyTuple_New(2);
2243 PyObject *ret0Py=ret0?Py_True:Py_False;
2245 PyTuple_SetItem(ret,0,ret0Py);
2246 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2250 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2252 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2253 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2254 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2255 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2256 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2257 PyObject *ret=PyTuple_New(5);
2258 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2259 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2260 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2261 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2262 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2266 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2268 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2269 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2270 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2271 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2272 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2273 PyObject *ret=PyTuple_New(5);
2274 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2275 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2276 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2277 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2278 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2282 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2284 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2285 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2286 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2287 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2288 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2289 PyObject *ret=PyTuple_New(5);
2290 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2291 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2292 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2293 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2294 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2298 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2300 DataArrayInt *neighbors=0,*neighborsIdx=0;
2301 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2302 PyObject *ret=PyTuple_New(2);
2303 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2304 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2308 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2310 DataArrayInt *neighbors=0,*neighborsIdx=0;
2311 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2312 PyObject *ret=PyTuple_New(2);
2313 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2314 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2318 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2320 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2321 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2322 DataArrayInt *d2,*d3,*d4,*dd5;
2323 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2324 PyObject *ret=PyTuple_New(7);
2325 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2326 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2327 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2328 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2329 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2330 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2331 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2335 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2338 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2339 da->checkAllocated();
2340 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2343 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2346 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2347 da->checkAllocated();
2348 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2351 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2354 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2355 da->checkAllocated();
2356 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2359 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2362 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2363 da->checkAllocated();
2364 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2365 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2366 PyObject *res = PyList_New(result.size());
2367 for (int i=0;iL!=result.end(); i++, iL++)
2368 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2372 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2375 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2376 da->checkAllocated();
2377 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2378 ret->setName(da->getName().c_str());
2382 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2384 DataArrayInt *cellNb1=0,*cellNb2=0;
2385 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2386 PyObject *ret=PyTuple_New(3);
2387 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2388 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2389 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2393 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2395 int spaceDim=self->getSpaceDimension();
2397 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2399 DataArrayDouble *a,*a2;
2400 DataArrayDoubleTuple *aa,*aa2;
2401 std::vector<double> bb,bb2;
2403 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2404 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2405 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2406 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2408 DataArrayInt *cellIds=0;
2409 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2410 PyObject *ret=PyTuple_New(2);
2411 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2412 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2416 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2418 int spaceDim=self->getSpaceDimension();
2420 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2422 DataArrayDouble *a,*a2;
2423 DataArrayDoubleTuple *aa,*aa2;
2424 std::vector<double> bb,bb2;
2426 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2427 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2428 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2429 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2431 DataArrayInt *cellIds=0;
2432 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2433 PyObject *ret=PyTuple_New(2);
2434 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2435 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2439 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2441 int spaceDim=self->getSpaceDimension();
2443 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2445 DataArrayDouble *a,*a2;
2446 DataArrayDoubleTuple *aa,*aa2;
2447 std::vector<double> bb,bb2;
2449 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2450 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2451 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2452 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2453 return self->getCellIdsCrossingPlane(orig,vect,eps);
2456 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2460 std::vector<int> pos2;
2461 DataArrayInt *pos3=0;
2462 DataArrayIntTuple *pos4=0;
2463 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2468 self->convertToPolyTypes(&pos1,&pos1+1);
2475 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2480 self->convertToPolyTypes(pos3->begin(),pos3->end());
2484 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2488 void convertAllToPoly();
2489 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2490 bool unPolyze() throw(INTERP_KERNEL::Exception);
2491 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2492 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2493 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2496 //== MEDCouplingUMesh End
2498 //== MEDCouplingExtrudedMesh
2500 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2503 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2504 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2506 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2508 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2511 std::string __str__() const throw(INTERP_KERNEL::Exception)
2513 return self->simpleRepr();
2516 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2518 std::ostringstream oss;
2519 self->reprQuickOverview(oss);
2523 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2525 MEDCouplingUMesh *ret=self->getMesh2D();
2528 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2530 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2532 MEDCouplingUMesh *ret=self->getMesh1D();
2535 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2537 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2539 DataArrayInt *ret=self->getMesh3DIds();
2542 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2547 //== MEDCouplingExtrudedMesh End
2549 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2552 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2553 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2554 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2555 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2556 virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2557 virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
2560 virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2562 int szArr,sw,iTypppArr;
2563 std::vector<int> stdvecTyyppArr;
2564 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2565 self->insertNextCell(tmp,tmp+szArr);
2568 virtual DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2570 DataArrayInt *ret=self->getNodalConnectivity();
2571 if(ret) ret->incrRef();
2575 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2577 std::vector< const MEDCoupling1GTUMesh *> parts;
2578 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
2579 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
2584 //== MEDCoupling1SGTUMesh
2586 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2589 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2590 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2591 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2592 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2593 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2594 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2595 MEDCoupling1GTUMesh *computeDualMesh() const throw(INTERP_KERNEL::Exception);
2596 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const throw(INTERP_KERNEL::Exception);
2597 DataArrayInt *sortHexa8EachOther() throw(INTERP_KERNEL::Exception);
2600 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2602 return MEDCoupling1SGTUMesh::New(name,type);
2605 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2607 return MEDCoupling1SGTUMesh::New(m);
2610 std::string __str__() const throw(INTERP_KERNEL::Exception)
2612 return self->simpleRepr();
2615 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2617 std::ostringstream oss;
2618 self->reprQuickOverview(oss);
2622 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2624 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2625 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2626 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2629 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2631 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2632 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2633 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2638 //== MEDCoupling1SGTUMesh End
2640 //== MEDCoupling1DGTUMesh
2642 class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2645 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2646 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2647 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
2648 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2649 bool isPacked() const throw(INTERP_KERNEL::Exception);
2652 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2654 return MEDCoupling1DGTUMesh::New(name,type);
2657 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2659 return MEDCoupling1DGTUMesh::New(m);
2662 std::string __str__() const throw(INTERP_KERNEL::Exception)
2664 return self->simpleRepr();
2667 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2669 std::ostringstream oss;
2670 self->reprQuickOverview(oss);
2674 DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
2676 DataArrayInt *ret=self->getNodalConnectivityIndex();
2677 if(ret) ret->incrRef();
2681 PyObject *retrievePackedNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2683 DataArrayInt *ret1=0,*ret2=0;
2684 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
2685 PyObject *ret0Py=ret0?Py_True:Py_False;
2687 PyObject *ret=PyTuple_New(3);
2688 PyTuple_SetItem(ret,0,ret0Py);
2689 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2690 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2694 PyObject *copyWithNodalConnectivityPacked() const throw(INTERP_KERNEL::Exception)
2697 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
2698 PyObject *ret=PyTuple_New(2);
2699 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
2700 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
2701 PyTuple_SetItem(ret,1,ret1Py);
2705 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2707 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2708 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2709 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
2712 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2714 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2715 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2716 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
2719 static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt) throw(INTERP_KERNEL::Exception)
2721 std::vector<const ParaMEDMEM::DataArrayInt *> tmp;
2722 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2723 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
2728 //== MEDCoupling1DGTUMeshEnd
2730 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2733 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2734 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2735 int getNumberOfCellsOfSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2736 virtual std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2737 std::vector<int> getCellGridStructure() const throw(INTERP_KERNEL::Exception);
2738 MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception);
2739 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
2740 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2743 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const throw(INTERP_KERNEL::Exception)
2745 int tmpp1=-1,tmpp2=-1;
2746 std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
2747 std::vector< std::pair<int,int> > inp;
2751 for(int i=0;i<tmpp1;i++)
2752 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2757 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
2758 inp.resize(tmpp1/2);
2759 for(int i=0;i<tmpp1/2;i++)
2760 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2763 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
2764 return self->buildStructuredSubPart(inp);
2767 static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) throw(INTERP_KERNEL::Exception)
2769 int tmpp1=-1,tmpp2=-1;
2770 std::vector<int> tmp=fillArrayWithPyListInt2(part,tmpp1,tmpp2);
2771 std::vector< std::pair<int,int> > inp;
2775 for(int i=0;i<tmpp1;i++)
2776 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2781 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.BuildExplicitIdsFrom : invalid input size ! Must be even size !");
2782 inp.resize(tmpp1/2);
2783 for(int i=0;i<tmpp1/2;i++)
2784 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2787 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.BuildExplicitIdsFrom : invalid input size !");
2789 int szArr,sw,iTypppArr;
2790 std::vector<int> stdvecTyyppArr;
2791 const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
2792 std::vector<int> tmp5(tmp4,tmp4+szArr);
2794 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
2797 static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) throw(INTERP_KERNEL::Exception)
2799 int szArr,sw,iTypppArr;
2800 std::vector<int> stdvecTyyppArr;
2801 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2802 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
2805 static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2807 int szArr,sw,iTypppArr;
2808 std::vector<int> stdvecTyyppArr;
2809 const int *tmp(convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr));
2810 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
2813 static PyObject *IsPartStructured(PyObject *li, PyObject *st) throw(INTERP_KERNEL::Exception)
2815 int szArr,sw,iTypppArr;
2816 std::vector<int> stdvecTyyppArr;
2817 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2818 int szArr2,sw2,iTypppArr2;
2819 std::vector<int> stdvecTyyppArr2;
2820 const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
2821 std::vector<int> tmp3(tmp2,tmp2+szArr2);
2822 std::vector< std::pair<int,int> > partCompactFormat;
2823 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
2824 PyObject *ret=PyTuple_New(2);
2825 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
2826 PyTuple_SetItem(ret,0,ret0Py);
2827 PyObject *ret1Py=PyList_New(partCompactFormat.size());
2828 for(std::size_t i=0;i<partCompactFormat.size();i++)
2830 PyObject *tmp4=PyTuple_New(2);
2831 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
2832 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
2833 PyList_SetItem(ret1Py,i,tmp4);
2835 PyTuple_SetItem(ret,1,ret1Py);
2841 //== MEDCouplingCMesh
2843 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2846 static MEDCouplingCMesh *New();
2847 static MEDCouplingCMesh *New(const std::string& meshName);
2848 MEDCouplingCMesh *clone(bool recDeepCpy) const;
2849 void setCoords(const DataArrayDouble *coordsX,
2850 const DataArrayDouble *coordsY=0,
2851 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
2852 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
2856 return MEDCouplingCMesh::New();
2858 MEDCouplingCMesh(const std::string& meshName)
2860 return MEDCouplingCMesh::New(meshName);
2862 std::string __str__() const throw(INTERP_KERNEL::Exception)
2864 return self->simpleRepr();
2866 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2868 std::ostringstream oss;
2869 self->reprQuickOverview(oss);
2872 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
2874 DataArrayDouble *ret=self->getCoordsAt(i);
2882 //== MEDCouplingCMesh End
2884 //== MEDCouplingCurveLinearMesh
2886 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2889 static MEDCouplingCurveLinearMesh *New();
2890 static MEDCouplingCurveLinearMesh *New(const std::string& meshName);
2891 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
2892 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
2894 MEDCouplingCurveLinearMesh()
2896 return MEDCouplingCurveLinearMesh::New();
2898 MEDCouplingCurveLinearMesh(const std::string& meshName)
2900 return MEDCouplingCurveLinearMesh::New(meshName);
2902 std::string __str__() const throw(INTERP_KERNEL::Exception)
2904 return self->simpleRepr();
2906 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2908 std::ostringstream oss;
2909 self->reprQuickOverview(oss);
2912 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
2914 DataArrayDouble *ret=self->getCoords();
2919 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
2921 int szArr,sw,iTypppArr;
2922 std::vector<int> stdvecTyyppArr;
2923 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
2924 self->setNodeGridStructure(tmp,tmp+szArr);
2929 //== MEDCouplingCurveLinearMesh End
2932 namespace ParaMEDMEM
2934 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
2937 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
2938 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
2939 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2940 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2941 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
2942 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
2943 void setName(const char *name) throw(INTERP_KERNEL::Exception);
2944 std::string getDescription() const throw(INTERP_KERNEL::Exception);
2945 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
2946 std::string getName() const throw(INTERP_KERNEL::Exception);
2947 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
2948 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
2949 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
2950 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
2951 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
2952 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
2953 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
2954 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
2955 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
2956 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
2957 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
2958 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
2959 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
2960 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
2961 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
2962 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
2964 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
2966 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
2969 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
2972 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
2974 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
2977 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
2980 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
2982 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
2983 return convertIntArrToPyList3(ret);
2986 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
2989 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
2990 PyObject *ret=PyTuple_New(2);
2991 PyObject *ret0Py=ret0?Py_True:Py_False;
2993 PyTuple_SetItem(ret,0,ret0Py);
2994 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2998 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
3000 DataArrayInt *ret1=0;
3001 MEDCouplingMesh *ret0=0;
3003 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3004 if (!SWIG_IsOK(res1))
3007 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3008 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3012 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3014 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3015 da2->checkAllocated();
3016 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3018 PyObject *res = PyList_New(2);
3019 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3020 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3024 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
3026 DataArrayInt *ret1=0;
3028 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3029 PyObject *res=PyTuple_New(2);
3030 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3032 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3035 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3036 PyTuple_SetItem(res,1,res1);
3041 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3044 int v0; std::vector<int> v1;
3045 const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
3046 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3049 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3050 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3053 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3054 if (!SWIG_IsOK(res1))
3057 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3058 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3062 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3064 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3065 da2->checkAllocated();
3066 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3070 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3072 std::vector<int> tmp;
3073 self->getCellIdsHavingGaussLocalization(locId,tmp);
3074 DataArrayInt *ret=DataArrayInt::New();
3075 ret->alloc((int)tmp.size(),1);
3076 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3077 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3080 int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
3082 std::vector<int> inp0;
3083 convertPyToNewIntArr4(code,1,3,inp0);
3084 std::vector<const DataArrayInt *> inp1;
3085 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(idsPerType,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",inp1);
3086 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3091 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3094 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3095 static MEDCouplingFieldTemplate *New(TypeOfField type);
3096 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3097 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3100 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3102 return MEDCouplingFieldTemplate::New(f);
3105 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3107 return MEDCouplingFieldTemplate::New(type);
3110 std::string __str__() const throw(INTERP_KERNEL::Exception)
3112 return self->simpleRepr();
3115 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3117 std::ostringstream oss;
3118 self->reprQuickOverview(oss);
3124 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3127 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3128 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3129 void setTimeUnit(const std::string& unit);
3130 std::string getTimeUnit() const;
3131 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3132 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3133 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3134 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3135 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3136 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
3137 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3138 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3139 MEDCouplingFieldDouble *deepCpy() const;
3140 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3141 MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
3142 MEDCouplingFieldDouble *cellToNodeDiscretization() const throw(INTERP_KERNEL::Exception);
3143 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3144 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3145 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3146 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3147 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3148 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3149 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3150 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3151 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3152 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3153 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3154 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3155 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3156 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3157 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3158 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3159 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3160 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3161 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3162 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3163 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3164 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3165 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3166 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3167 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3168 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3169 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3170 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3171 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3172 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3173 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3174 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3175 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3176 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3177 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3178 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3179 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3180 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3181 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3182 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3183 void fillFromAnalytic(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3184 void fillFromAnalytic2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3185 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3186 void applyFunc(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3187 void applyFunc2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3188 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3189 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3190 void applyFunc(const std::string& func) throw(INTERP_KERNEL::Exception);
3191 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
3192 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
3193 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3194 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3195 double getMinValue() const throw(INTERP_KERNEL::Exception);
3196 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3197 double norm2() const throw(INTERP_KERNEL::Exception);
3198 double normMax() const throw(INTERP_KERNEL::Exception);
3199 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3200 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3201 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3202 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3203 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3204 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3205 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3206 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3207 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3208 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3209 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3210 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3211 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3212 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3213 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3214 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3215 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3216 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3217 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3218 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3219 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3220 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3222 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3224 return MEDCouplingFieldDouble::New(type,td);
3227 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3229 return MEDCouplingFieldDouble::New(ft,td);
3232 std::string __str__() const throw(INTERP_KERNEL::Exception)
3234 return self->simpleRepr();
3237 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3239 std::ostringstream oss;
3240 self->reprQuickOverview(oss);
3244 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3246 DataArrayDouble *ret=self->getArray();
3252 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3254 std::vector<DataArrayDouble *> arrs=self->getArrays();
3255 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3259 PyObject *ret=PyTuple_New(sz);
3260 for(int i=0;i<sz;i++)
3263 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3265 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3270 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3272 std::vector<const DataArrayDouble *> tmp;
3273 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3275 std::vector<DataArrayDouble *> arrs(sz);
3276 for(int i=0;i<sz;i++)
3277 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3278 self->setArrays(arrs);
3281 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3283 DataArrayDouble *ret=self->getEndArray();
3289 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3293 DataArrayDoubleTuple *aa;
3294 std::vector<double> bb;
3296 const MEDCouplingMesh *mesh=self->getMesh();
3298 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3299 int spaceDim=mesh->getSpaceDimension();
3300 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3301 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3303 int sz=self->getNumberOfComponents();
3304 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3305 self->getValueOn(spaceLoc,res);
3306 return convertDblArrToPyList(res,sz);
3309 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3311 int sz=self->getNumberOfComponents();
3312 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3313 self->getValueOnPos(i,j,k,res);
3314 return convertDblArrToPyList(res,sz);
3317 DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
3319 const MEDCouplingMesh *mesh(self->getMesh());
3321 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3324 double v0; ParaMEDMEM::DataArrayDouble *v1(0); ParaMEDMEM::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
3325 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
3326 mesh->getSpaceDimension(),true,nbPts);
3327 return self->getValueOnMulti(inp,nbPts);
3330 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3334 DataArrayDoubleTuple *aa;
3335 std::vector<double> bb;
3337 const MEDCouplingMesh *mesh=self->getMesh();
3339 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3340 int spaceDim=mesh->getSpaceDimension();
3341 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3342 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3345 int sz=self->getNumberOfComponents();
3346 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3347 self->getValueOn(spaceLoc,time,res);
3348 return convertDblArrToPyList(res,sz);
3351 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3353 if(self->getArray()!=0)
3354 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3357 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3358 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3359 self->setArray(arr);
3363 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3366 double tmp0=self->getTime(tmp1,tmp2);
3367 PyObject *res = PyList_New(3);
3368 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3369 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3370 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3374 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3377 double tmp0=self->getStartTime(tmp1,tmp2);
3378 PyObject *res = PyList_New(3);
3379 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3380 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3381 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3385 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3388 double tmp0=self->getEndTime(tmp1,tmp2);
3389 PyObject *res = PyList_New(3);
3390 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3391 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3392 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3395 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3397 int sz=self->getNumberOfComponents();
3398 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3399 self->accumulate(tmp);
3400 return convertDblArrToPyList(tmp,sz);
3402 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3404 int sz=self->getNumberOfComponents();
3405 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3406 self->integral(isWAbs,tmp);
3407 return convertDblArrToPyList(tmp,sz);
3409 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3411 int sz=self->getNumberOfComponents();
3412 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3413 self->getWeightedAverageValue(tmp,isWAbs);
3414 return convertDblArrToPyList(tmp,sz);
3416 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3418 int sz=self->getNumberOfComponents();
3419 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3421 return convertDblArrToPyList(tmp,sz);
3423 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3425 int sz=self->getNumberOfComponents();
3426 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3428 return convertDblArrToPyList(tmp,sz);
3430 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3432 int szArr,sw,iTypppArr;
3433 std::vector<int> stdvecTyyppArr;
3434 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3435 self->renumberCells(tmp,check);
3438 void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3440 int szArr,sw,iTypppArr;
3441 std::vector<int> stdvecTyyppArr;
3442 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3443 self->renumberCellsWithoutMesh(tmp,check);
3446 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3448 int szArr,sw,iTypppArr;
3449 std::vector<int> stdvecTyyppArr;
3450 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3451 self->renumberNodes(tmp,eps);
3454 void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3456 int szArr,sw,iTypppArr;
3457 std::vector<int> stdvecTyyppArr;
3458 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3459 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
3462 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3466 std::vector<int> multiVal;
3467 std::pair<int, std::pair<int,int> > slic;
3468 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3469 const MEDCouplingMesh *mesh=self->getMesh();
3471 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3472 int nbc=mesh->getNumberOfCells();
3473 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3480 std::ostringstream oss;
3481 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3482 throw INTERP_KERNEL::Exception(oss.str().c_str());
3485 return self->buildSubPart(&singleVal,&singleVal+1);
3490 int tmp=nbc+singleVal;
3491 return self->buildSubPart(&tmp,&tmp+1);
3495 std::ostringstream oss;
3496 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3497 throw INTERP_KERNEL::Exception(oss.str().c_str());
3503 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3507 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3512 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3513 daIntTyypp->checkAllocated();
3514 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3517 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3521 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3523 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";
3524 if(PyTuple_Check(li))
3526 Py_ssize_t sz=PyTuple_Size(li);
3528 throw INTERP_KERNEL::Exception(msg);
3529 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3532 std::vector<int> multiVal;
3533 std::pair<int, std::pair<int,int> > slic;
3534 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3535 if(!self->getArray())
3536 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3538 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3539 catch(INTERP_KERNEL::Exception& e)
3540 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3541 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3542 DataArrayDouble *ret0Arr=ret0->getArray();
3544 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3549 std::vector<int> v2(1,singleVal);
3550 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3551 ret0->setArray(aarr);
3556 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3557 ret0->setArray(aarr);
3562 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3563 std::vector<int> v2(nbOfComp);
3564 for(int i=0;i<nbOfComp;i++)
3565 v2[i]=slic.first+i*slic.second.second;
3566 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3567 ret0->setArray(aarr);
3571 throw INTERP_KERNEL::Exception(msg);
3576 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3579 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3582 double r1=self->getMaxValue2(tmp);
3583 PyObject *ret=PyTuple_New(2);
3584 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3585 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3589 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3592 double r1=self->getMinValue2(tmp);
3593 PyObject *ret=PyTuple_New(2);
3594 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3595 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3599 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3601 std::vector<int> tmp;
3602 convertPyToNewIntArr3(li,tmp);
3603 return self->keepSelectedComponents(tmp);
3606 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3608 std::vector<int> tmp;
3609 convertPyToNewIntArr3(li,tmp);
3610 self->setSelectedComponents(f,tmp);
3613 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3616 DataArrayDouble *a,*a2;
3617 DataArrayDoubleTuple *aa,*aa2;
3618 std::vector<double> bb,bb2;
3621 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
3622 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
3623 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3624 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3626 return self->extractSlice3D(orig,vect,eps);
3629 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3631 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
3634 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3636 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
3639 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3641 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.";
3642 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
3645 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3647 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3649 return (*self)-(*other);
3651 throw INTERP_KERNEL::Exception(msg);
3656 DataArrayDoubleTuple *aa;
3657 std::vector<double> bb;
3659 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3664 if(!self->getArray())
3665 throw INTERP_KERNEL::Exception(msg2);
3666 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3667 ret->applyLin(1.,-val);
3668 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3669 ret2->setArray(ret);
3674 if(!self->getArray())
3675 throw INTERP_KERNEL::Exception(msg2);
3676 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
3677 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3678 ret2->setArray(ret);
3683 if(!self->getArray())
3684 throw INTERP_KERNEL::Exception(msg2);
3685 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3686 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3687 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3688 ret2->setArray(ret);
3693 if(!self->getArray())
3694 throw INTERP_KERNEL::Exception(msg2);
3695 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3696 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3697 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3698 ret2->setArray(ret);
3702 { throw INTERP_KERNEL::Exception(msg); }
3706 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3708 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
3711 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3713 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
3716 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3718 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
3721 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3723 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.";
3724 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
3727 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3729 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3731 return (*self)/(*other);
3733 throw INTERP_KERNEL::Exception(msg);
3738 DataArrayDoubleTuple *aa;
3739 std::vector<double> bb;
3741 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3747 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
3748 if(!self->getArray())
3749 throw INTERP_KERNEL::Exception(msg2);
3750 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3751 ret->applyLin(1./val,0);
3752 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3753 ret2->setArray(ret);
3758 if(!self->getArray())
3759 throw INTERP_KERNEL::Exception(msg2);
3760 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
3761 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3762 ret2->setArray(ret);
3767 if(!self->getArray())
3768 throw INTERP_KERNEL::Exception(msg2);
3769 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3770 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3771 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3772 ret2->setArray(ret);
3777 if(!self->getArray())
3778 throw INTERP_KERNEL::Exception(msg2);
3779 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3780 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3781 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3782 ret2->setArray(ret);
3786 { throw INTERP_KERNEL::Exception(msg); }
3790 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3792 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
3795 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3797 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.";
3798 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
3801 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3803 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3805 return (*self)^(*other);
3807 throw INTERP_KERNEL::Exception(msg);
3812 DataArrayDoubleTuple *aa;
3813 std::vector<double> bb;
3815 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3820 if(!self->getArray())
3821 throw INTERP_KERNEL::Exception(msg2);
3822 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3824 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3825 ret2->setArray(ret);
3830 if(!self->getArray())
3831 throw INTERP_KERNEL::Exception(msg2);
3832 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
3833 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3834 ret2->setArray(ret);
3839 if(!self->getArray())
3840 throw INTERP_KERNEL::Exception(msg2);
3841 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3842 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3843 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3844 ret2->setArray(ret);
3849 if(!self->getArray())
3850 throw INTERP_KERNEL::Exception(msg2);
3851 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3852 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3853 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3854 ret2->setArray(ret);
3858 { throw INTERP_KERNEL::Exception(msg); }
3862 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
3864 return self->negate();
3867 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3869 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.";
3870 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
3873 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3875 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3879 Py_XINCREF(trueSelf);
3883 throw INTERP_KERNEL::Exception(msg);
3888 DataArrayDoubleTuple *aa;
3889 std::vector<double> bb;
3891 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3896 if(!self->getArray())
3897 throw INTERP_KERNEL::Exception(msg2);
3898 self->getArray()->applyLin(1.,val);
3899 Py_XINCREF(trueSelf);
3904 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3907 Py_XINCREF(trueSelf);
3912 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3913 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3914 ret2->setArray(aaa);
3916 Py_XINCREF(trueSelf);
3921 if(!self->getArray())
3922 throw INTERP_KERNEL::Exception(msg2);
3923 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3924 self->getArray()->addEqual(aaa);
3925 Py_XINCREF(trueSelf);
3929 { throw INTERP_KERNEL::Exception(msg); }
3933 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3935 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.";
3936 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
3939 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3941 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3945 Py_XINCREF(trueSelf);
3949 throw INTERP_KERNEL::Exception(msg);
3954 DataArrayDoubleTuple *aa;
3955 std::vector<double> bb;
3957 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3962 if(!self->getArray())
3963 throw INTERP_KERNEL::Exception(msg2);
3964 self->getArray()->applyLin(1.,-val);
3965 Py_XINCREF(trueSelf);
3970 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3973 Py_XINCREF(trueSelf);
3978 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3979 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3980 ret2->setArray(aaa);
3982 Py_XINCREF(trueSelf);
3987 if(!self->getArray())
3988 throw INTERP_KERNEL::Exception(msg2);
3989 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3990 self->getArray()->substractEqual(aaa);
3991 Py_XINCREF(trueSelf);
3995 { throw INTERP_KERNEL::Exception(msg); }
3999 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4001 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.";
4002 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4005 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4007 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4011 Py_XINCREF(trueSelf);
4015 throw INTERP_KERNEL::Exception(msg);
4020 DataArrayDoubleTuple *aa;
4021 std::vector<double> bb;
4023 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4028 if(!self->getArray())
4029 throw INTERP_KERNEL::Exception(msg2);
4030 self->getArray()->applyLin(val,0);
4031 Py_XINCREF(trueSelf);
4036 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4039 Py_XINCREF(trueSelf);
4044 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4045 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4046 ret2->setArray(aaa);
4048 Py_XINCREF(trueSelf);
4053 if(!self->getArray())
4054 throw INTERP_KERNEL::Exception(msg2);
4055 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4056 self->getArray()->multiplyEqual(aaa);
4057 Py_XINCREF(trueSelf);
4061 { throw INTERP_KERNEL::Exception(msg); }
4065 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4067 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.";
4068 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4071 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4073 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4077 Py_XINCREF(trueSelf);
4081 throw INTERP_KERNEL::Exception(msg);
4086 DataArrayDoubleTuple *aa;
4087 std::vector<double> bb;
4089 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4095 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4096 if(!self->getArray())
4097 throw INTERP_KERNEL::Exception(msg2);
4098 self->getArray()->applyLin(1./val,0);
4099 Py_XINCREF(trueSelf);
4104 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4107 Py_XINCREF(trueSelf);
4112 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4113 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4114 ret2->setArray(aaa);
4116 Py_XINCREF(trueSelf);
4121 if(!self->getArray())
4122 throw INTERP_KERNEL::Exception(msg2);
4123 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4124 self->getArray()->divideEqual(aaa);
4125 Py_XINCREF(trueSelf);
4129 { throw INTERP_KERNEL::Exception(msg); }
4133 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4135 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.";
4136 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4139 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4141 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4145 Py_XINCREF(trueSelf);
4149 throw INTERP_KERNEL::Exception(msg);
4154 DataArrayDoubleTuple *aa;
4155 std::vector<double> bb;
4157 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4162 if(!self->getArray())
4163 throw INTERP_KERNEL::Exception(msg2);
4164 self->getArray()->applyPow(val);
4165 Py_XINCREF(trueSelf);
4170 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4173 Py_XINCREF(trueSelf);
4178 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4179 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4180 ret2->setArray(aaa);
4182 Py_XINCREF(trueSelf);
4187 if(!self->getArray())
4188 throw INTERP_KERNEL::Exception(msg2);
4189 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4190 self->getArray()->powEqual(aaa);
4191 Py_XINCREF(trueSelf);
4195 { throw INTERP_KERNEL::Exception(msg); }
4199 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4201 std::vector<const MEDCouplingFieldDouble *> tmp;
4202 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4203 return MEDCouplingFieldDouble::MergeFields(tmp);
4206 static void WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
4208 std::vector<const MEDCouplingFieldDouble *> tmp;
4209 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4210 MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4215 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4218 int getNumberOfFields() const;
4219 MEDCouplingMultiFields *deepCpy() const;
4220 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4221 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4222 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4223 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4224 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4227 std::string __str__() const throw(INTERP_KERNEL::Exception)
4229 return self->simpleRepr();
4231 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4233 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4234 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4236 std::vector<MEDCouplingFieldDouble *> fs(sz);
4237 for(int i=0;i<sz;i++)
4238 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4239 return MEDCouplingMultiFields::New(fs);
4241 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4243 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4244 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4246 std::vector<MEDCouplingFieldDouble *> fs(sz);
4247 for(int i=0;i<sz;i++)
4248 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4249 return MEDCouplingMultiFields::New(fs);
4251 PyObject *getFields() const
4253 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4254 int sz=fields.size();
4255 PyObject *res = PyList_New(sz);
4256 for(int i=0;i<sz;i++)
4260 fields[i]->incrRef();
4261 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4265 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4270 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4272 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4276 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4279 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4281 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4283 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4285 PyObject *res = PyList_New(sz);
4286 for(int i=0;i<sz;i++)
4291 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4295 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4300 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4302 std::vector<int> refs;
4303 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4305 PyObject *res = PyList_New(sz);
4306 for(int i=0;i<sz;i++)
4311 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4315 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4319 PyObject *ret=PyTuple_New(2);
4320 PyTuple_SetItem(ret,0,res);
4321 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4324 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4326 std::vector<DataArrayDouble *> ms=self->getArrays();
4328 PyObject *res = PyList_New(sz);
4329 for(int i=0;i<sz;i++)
4334 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4338 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4343 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4345 std::vector< std::vector<int> > refs;
4346 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4348 PyObject *res = PyList_New(sz);
4349 PyObject *res2 = PyList_New(sz);
4350 for(int i=0;i<sz;i++)
4355 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4359 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4361 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4364 PyObject *ret=PyTuple_New(2);
4365 PyTuple_SetItem(ret,0,res);
4366 PyTuple_SetItem(ret,1,res2);
4372 class MEDCouplingDefinitionTime
4375 MEDCouplingDefinitionTime();
4376 void assign(const MEDCouplingDefinitionTime& other);
4377 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4378 double getTimeResolution() const;
4379 std::vector<double> getHotSpotsTime() const;
4382 std::string __str__() const throw(INTERP_KERNEL::Exception)
4384 std::ostringstream oss;
4385 self->appendRepr(oss);
4389 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4391 int meshId,arrId,arrIdInField,fieldId;
4392 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4393 PyObject *res=PyList_New(4);
4394 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4395 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4396 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4397 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4401 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4403 int meshId,arrId,arrIdInField,fieldId;
4404 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4405 PyObject *res=PyList_New(4);
4406 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4407 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4408 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4409 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4415 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4418 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4419 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4423 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4425 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4426 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4428 std::vector<MEDCouplingFieldDouble *> fs(sz);
4429 for(int i=0;i<sz;i++)
4430 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4431 return MEDCouplingFieldOverTime::New(fs);
4433 std::string __str__() const throw(INTERP_KERNEL::Exception)
4435 return self->simpleRepr();
4437 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4439 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4440 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4442 std::vector<MEDCouplingFieldDouble *> fs(sz);
4443 for(int i=0;i<sz;i++)
4444 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4445 return MEDCouplingFieldOverTime::New(fs);
4453 __filename=os.environ.get('PYTHONSTARTUP')
4454 if __filename and os.path.isfile(__filename):
4455 execfile(__filename)