1 // Copyright (C) 2007-2013 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.
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::rearrange2ConsecutiveCellTypes;
242 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
243 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
244 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
245 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
246 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
247 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
248 %newobject ParaMEDMEM::MEDCouplingUMesh::convertLinearCellsToQuadratic;
249 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
250 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
251 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
252 %newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField;
253 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner;
254 %newobject ParaMEDMEM::MEDCouplingUMesh::computePlaneEquationOf3DFaces;
255 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField;
256 %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
257 %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
258 %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
259 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
260 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
261 %newobject ParaMEDMEM::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
262 %newobject ParaMEDMEM::MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh;
263 %newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
264 %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
265 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis;
266 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsCrossingPlane;
267 %newobject ParaMEDMEM::MEDCouplingUMesh::convexEnvelop2D;
268 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
269 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf2DMesh;
270 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf3DMesh;
271 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
272 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
273 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic;
274 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
275 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
276 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::New;
277 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::getNodalConnectivity;
278 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
279 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::New;
280 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
281 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::computeDualMesh;
282 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
283 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::sortHexa8EachOther;
284 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
285 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
286 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::New;
287 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
288 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
289 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
290 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
291 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
292 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
293 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::buildStructuredSubPart;
294 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTUnstructured;
295 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
296 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
297 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
298 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
299 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
300 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
301 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
302 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
303 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
304 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
305 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
307 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
308 %feature("unref") MEDCouplingMesh "$this->decrRef();"
309 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
310 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
311 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
312 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
313 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
314 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
315 %feature("unref") MEDCouplingField "$this->decrRef();"
316 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
317 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
318 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
319 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
320 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
321 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
322 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
323 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
324 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
326 %rename(assign) *::operator=;
327 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
328 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
329 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
330 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
334 %rename (InterpKernelException) INTERP_KERNEL::Exception;
336 %include "MEDCouplingRefCountObject.i"
337 %include "MEDCouplingMemArray.i"
355 CONST_ON_TIME_INTERVAL = 7
356 } TypeOfTimeDiscretization;
364 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
365 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11
366 } MEDCouplingMeshType;
369 class DataArrayDouble;
370 class MEDCouplingUMesh;
371 class MEDCouplingFieldDouble;
373 %extend RefCountObject
375 std::string getHiddenCppPointer() const
377 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
382 %extend MEDCouplingGaussLocalization
384 std::string __str__() const throw(INTERP_KERNEL::Exception)
386 return self->getStringRepr();
389 std::string __repr__() const throw(INTERP_KERNEL::Exception)
391 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
392 oss << self->getStringRepr();
399 class MEDCouplingMesh : public RefCountObject, public TimeLabel
402 void setName(const std::string& name);
403 std::string getName() const;
404 void setDescription(const std::string& descr);
405 std::string getDescription() const;
406 void setTime(double val, int iteration, int order);
407 void setTimeUnit(const std::string& unit);
408 std::string getTimeUnit() const;
409 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
410 bool isStructured() const throw(INTERP_KERNEL::Exception);
411 virtual MEDCouplingMesh *deepCpy() const;
412 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
413 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
414 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
415 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
416 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
417 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
418 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
419 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
420 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
421 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
422 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
423 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
424 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
425 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
426 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
427 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
428 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
429 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
430 virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
431 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
432 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
433 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
434 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
435 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
436 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
438 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
439 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
440 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
441 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
442 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception);
443 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
444 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
445 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
446 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
447 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
448 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
449 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
450 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
451 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
452 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
453 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
454 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
457 std::string __str__() const throw(INTERP_KERNEL::Exception)
459 return self->simpleRepr();
462 PyObject *getTime() throw(INTERP_KERNEL::Exception)
465 double tmp0=self->getTime(tmp1,tmp2);
466 PyObject *res = PyList_New(3);
467 PyList_SetItem(res,0,SWIG_From_double(tmp0));
468 PyList_SetItem(res,1,SWIG_From_int(tmp1));
469 PyList_SetItem(res,2,SWIG_From_int(tmp2));
473 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
477 DataArrayDoubleTuple *aa;
478 std::vector<double> bb;
480 int spaceDim=self->getSpaceDimension();
481 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
482 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
483 return self->getCellContainingPoint(pos,eps);
486 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
490 DataArrayDoubleTuple *aa;
491 std::vector<double> bb;
493 int spaceDim=self->getSpaceDimension();
494 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
495 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
496 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
497 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
498 PyObject *ret=PyTuple_New(2);
499 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
500 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
504 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
506 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
507 int spaceDim=self->getSpaceDimension();
509 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
510 if (!SWIG_IsOK(res1))
513 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
514 int nbOfPoints=size/spaceDim;
517 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
519 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
523 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
525 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
526 da2->checkAllocated();
527 int size=da2->getNumberOfTuples();
528 int nbOfCompo=da2->getNumberOfComponents();
529 if(nbOfCompo!=spaceDim)
531 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
533 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
535 PyObject *ret=PyTuple_New(2);
536 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
537 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
541 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
545 DataArrayDoubleTuple *aa;
546 std::vector<double> bb;
548 int spaceDim=self->getSpaceDimension();
549 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
550 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
551 std::vector<int> elts;
552 self->getCellsContainingPoint(pos,eps,elts);
553 DataArrayInt *ret=DataArrayInt::New();
554 ret->alloc((int)elts.size(),1);
555 std::copy(elts.begin(),elts.end(),ret->getPointer());
556 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
559 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
561 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
562 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
563 self->getReverseNodalConnectivity(d0,d1);
564 PyObject *ret=PyTuple_New(2);
565 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
566 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
570 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
573 int v0; std::vector<int> v1;
574 const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
575 self->renumberCells(ids,check);
578 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
580 DataArrayInt *cellCor, *nodeCor;
581 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
582 PyObject *res = PyList_New(2);
583 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
584 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
588 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
590 DataArrayInt *cellCor=0,*nodeCor=0;
591 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
592 PyObject *res = PyList_New(2);
593 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
594 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
598 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
600 DataArrayInt *cellCor=0;
601 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
605 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
608 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
609 if (!SWIG_IsOK(res1))
612 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
613 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
617 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
619 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
620 da2->checkAllocated();
621 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
624 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
626 std::vector<int> conn;
627 self->getNodeIdsOfCell(cellId,conn);
628 return convertIntArrToPyList2(conn);
631 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
633 std::vector<double> coo;
634 self->getCoordinatesOfNode(nodeId,coo);
635 return convertDblArrToPyList2(coo);
638 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
642 DataArrayDoubleTuple *aa;
643 std::vector<double> bb;
645 int spaceDim=self->getSpaceDimension();
646 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
647 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
648 self->scale(pointPtr,factor);
651 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
653 int spaceDim=self->getSpaceDimension();
654 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
655 self->getBoundingBox(tmp);
656 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
660 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
663 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
664 PyObject *ret=PyTuple_New(2);
665 PyObject *ret0Py=ret0?Py_True:Py_False;
667 PyTuple_SetItem(ret,0,ret0Py);
668 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
672 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
674 int szArr,sw,iTypppArr;
675 std::vector<int> stdvecTyyppArr;
676 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
677 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
678 if(sw==3)//DataArrayInt
680 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
681 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
682 std::string name=argpt->getName();
684 ret->setName(name.c_str());
686 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
689 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
691 int szArr,sw,iTypppArr;
692 std::vector<int> stdvecTyyppArr;
694 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
695 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
696 if(sw==3)//DataArrayInt
698 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
699 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
700 std::string name=argpt->getName();
702 ret->setName(name.c_str());
705 PyObject *res = PyList_New(2);
706 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
707 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
708 PyList_SetItem(res,0,obj0);
709 PyList_SetItem(res,1,obj1);
713 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
717 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
718 PyObject *res = PyTuple_New(2);
719 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
722 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
724 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
725 PyTuple_SetItem(res,0,obj0);
726 PyTuple_SetItem(res,1,obj1);
730 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
732 std::vector<int> vals=self->getDistributionOfTypes();
734 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
735 PyObject *ret=PyList_New((int)vals.size()/3);
736 for(int j=0;j<(int)vals.size()/3;j++)
738 PyObject *ret1=PyList_New(3);
739 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
740 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
741 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
742 PyList_SetItem(ret,j,ret1);
747 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
749 std::vector<int> code;
750 std::vector<const DataArrayInt *> idsPerType;
751 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
752 convertPyToNewIntArr4(li,1,3,code);
753 return self->checkTypeConsistencyAndContig(code,idsPerType);
756 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
758 std::vector<int> code;
759 std::vector<DataArrayInt *> idsInPflPerType;
760 std::vector<DataArrayInt *> idsPerType;
761 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
762 PyObject *ret=PyTuple_New(3);
765 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
766 PyObject *ret0=PyList_New((int)code.size()/3);
767 for(int j=0;j<(int)code.size()/3;j++)
769 PyObject *ret00=PyList_New(3);
770 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
771 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
772 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
773 PyList_SetItem(ret0,j,ret00);
775 PyTuple_SetItem(ret,0,ret0);
777 PyObject *ret1=PyList_New(idsInPflPerType.size());
778 for(std::size_t j=0;j<idsInPflPerType.size();j++)
779 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
780 PyTuple_SetItem(ret,1,ret1);
781 int n=idsPerType.size();
782 PyObject *ret2=PyList_New(n);
784 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
785 PyTuple_SetItem(ret,2,ret2);
789 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
793 DataArrayDoubleTuple *aa;
794 std::vector<double> bb;
796 int spaceDim=self->getSpaceDimension();
797 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
798 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
799 self->translate(vectorPtr);
802 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
804 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
807 DataArrayDoubleTuple *aa;
808 std::vector<double> bb;
810 int spaceDim=self->getSpaceDimension();
811 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
812 self->rotate(centerPtr,0,alpha);
815 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
817 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
819 DataArrayDouble *a,*a2;
820 DataArrayDoubleTuple *aa,*aa2;
821 std::vector<double> bb,bb2;
823 int spaceDim=self->getSpaceDimension();
824 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
825 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
826 self->rotate(centerPtr,vectorPtr,alpha);
829 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
831 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
832 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
833 PyObject *res=PyList_New(result.size());
834 for(int i=0;iL!=result.end(); i++, iL++)
835 PyList_SetItem(res,i,PyInt_FromLong(*iL));
839 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
841 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
842 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
843 return MEDCouplingMesh::MergeMeshes(tmp);
849 //== MEDCouplingMesh End
851 %include "NormalizedGeometricTypes"
852 %include "MEDCouplingNatureOfFieldEnum"
856 class MEDCouplingNatureOfField
859 static const char *GetRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception);
860 static std::string GetReprNoThrow(NatureOfField nat);
861 static std::string GetAllPossibilitiesStr();
865 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
866 // include "MEDCouplingTimeDiscretization.i"
870 class MEDCouplingGaussLocalization
873 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
874 const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
875 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
876 INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
877 void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
878 int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
879 int getDimension() const throw(INTERP_KERNEL::Exception);
880 int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
881 std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
882 void checkCoherency() const throw(INTERP_KERNEL::Exception);
883 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception);
885 const std::vector<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
886 double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
887 const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
888 double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
889 const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
890 double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
891 void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
892 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
893 void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
894 void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
895 void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
896 void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
898 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
902 %include "MEDCouplingFieldDiscretization.i"
904 //== MEDCouplingPointSet
908 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
911 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
912 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
913 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
914 void zipCoords() throw(INTERP_KERNEL::Exception);
915 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
916 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
917 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
918 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
919 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
920 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
921 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
922 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
923 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
924 static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception);
925 virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
926 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
927 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
928 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
929 virtual DataArrayInt *findBoundaryNodes() const;
930 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
931 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
932 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
933 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
934 virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
935 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
938 std::string __str__() const throw(INTERP_KERNEL::Exception)
940 return self->simpleRepr();
943 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
946 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
947 PyObject *res = PyList_New(2);
948 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
949 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
953 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
955 DataArrayInt *comm, *commIndex;
956 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
957 PyObject *res = PyList_New(2);
958 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
959 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
963 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
965 DataArrayDouble *ret1=self->getCoords();
968 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
971 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
973 int szArr,sw,iTypppArr;
974 std::vector<int> stdvecTyyppArr;
975 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
976 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
977 if(sw==3)//DataArrayInt
979 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
980 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
981 std::string name=argpt->getName();
983 ret->setName(name.c_str());
985 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
988 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
990 int szArr,sw,iTypppArr;
991 std::vector<int> stdvecTyyppArr;
992 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
993 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
994 if(sw==3)//DataArrayInt
996 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
997 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
998 std::string name=argpt->getName();
1000 ret->setName(name.c_str());
1002 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1005 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
1007 int szArr,sw,iTypppArr;
1008 std::vector<int> stdvecTyyppArr;
1009 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1010 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1011 if(sw==3)//DataArrayInt
1013 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1014 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1015 std::string name=argpt->getName();
1017 ret->setName(name.c_str());
1019 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1022 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1024 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1025 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1028 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1030 int szArr,sw,iTypppArr;
1031 std::vector<int> stdvecTyyppArr;
1032 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1033 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1034 if(sw==3)//DataArrayInt
1036 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1037 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1038 std::string name=argpt->getName();
1040 ret->setName(name.c_str());
1042 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1045 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1047 int szArr,sw,iTypppArr;
1048 std::vector<int> stdvecTyyppArr;
1049 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1050 self->renumberNodes(tmp,newNbOfNodes);
1053 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1055 int szArr,sw,iTypppArr;
1056 std::vector<int> stdvecTyyppArr;
1057 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1058 self->renumberNodes2(tmp,newNbOfNodes);
1061 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1063 int spaceDim=self->getSpaceDimension();
1065 DataArrayDouble *a,*a2;
1066 DataArrayDoubleTuple *aa,*aa2;
1067 std::vector<double> bb,bb2;
1069 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1070 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1071 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1072 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1073 std::vector<int> nodes;
1074 self->findNodesOnLine(p,v,eps,nodes);
1075 DataArrayInt *ret=DataArrayInt::New();
1076 ret->alloc((int)nodes.size(),1);
1077 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1078 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1080 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1082 int spaceDim=self->getSpaceDimension();
1084 DataArrayDouble *a,*a2;
1085 DataArrayDoubleTuple *aa,*aa2;
1086 std::vector<double> bb,bb2;
1088 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1089 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1090 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1091 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1092 std::vector<int> nodes;
1093 self->findNodesOnPlane(p,v,eps,nodes);
1094 DataArrayInt *ret=DataArrayInt::New();
1095 ret->alloc((int)nodes.size(),1);
1096 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1097 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1100 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1104 DataArrayDoubleTuple *aa;
1105 std::vector<double> bb;
1107 int spaceDim=self->getSpaceDimension();
1108 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1109 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1110 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1111 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1114 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1116 DataArrayInt *c=0,*cI=0;
1120 DataArrayDoubleTuple *aa;
1121 std::vector<double> bb;
1123 int spaceDim=self->getSpaceDimension();
1124 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1125 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1126 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1127 PyObject *ret=PyTuple_New(2);
1128 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1129 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1133 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1135 DataArrayInt *c=0,*cI=0;
1136 int spaceDim=self->getSpaceDimension();
1139 DataArrayDoubleTuple *aa;
1140 std::vector<double> bb;
1143 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1144 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1146 PyObject *ret=PyTuple_New(2);
1147 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1148 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1152 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1156 DataArrayDoubleTuple *aa;
1157 std::vector<double> bb;
1159 int spaceDim=self->getSpaceDimension();
1160 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1161 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1163 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1164 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1167 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1171 std::vector<int> multiVal;
1172 std::pair<int, std::pair<int,int> > slic;
1173 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1174 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1178 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1180 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1182 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1184 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1188 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1190 DataArrayInt *v0=0,*v1=0;
1191 self->findCommonCells(compType,startCellId,v0,v1);
1192 PyObject *res = PyList_New(2);
1193 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1194 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1199 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1202 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1203 if (!SWIG_IsOK(res1))
1206 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1207 self->renumberNodesInConn(tmp);
1211 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1213 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1214 da2->checkAllocated();
1215 self->renumberNodesInConn(da2->getConstPointer());
1219 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1222 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1223 PyObject *ret=PyTuple_New(2);
1224 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1225 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1229 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1231 DataArrayInt *ret=0;
1233 int szArr,sw,iTypppArr;
1234 std::vector<int> stdvecTyyppArr;
1235 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1236 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1240 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1244 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1245 PyObject *res = PyList_New(3);
1246 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1247 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1248 PyList_SetItem(res,2,SWIG_From_int(ret2));
1252 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1256 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1257 PyObject *res = PyList_New(3);
1258 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1259 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1260 PyList_SetItem(res,2,SWIG_From_int(ret2));
1264 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1267 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1268 if (!SWIG_IsOK(res1))
1271 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1272 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1276 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1278 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1279 da2->checkAllocated();
1280 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1284 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1288 std::vector<int> multiVal;
1289 std::pair<int, std::pair<int,int> > slic;
1290 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1291 int nbc=self->getNumberOfCells();
1292 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1299 std::ostringstream oss;
1300 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1301 throw INTERP_KERNEL::Exception(oss.str().c_str());
1304 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1309 int tmp=nbc+singleVal;
1310 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1314 std::ostringstream oss;
1315 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1316 throw INTERP_KERNEL::Exception(oss.str().c_str());
1322 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1326 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1331 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1332 daIntTyypp->checkAllocated();
1333 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1336 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1340 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1343 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1344 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1345 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1346 for(int i=0;i<sz;i++)
1347 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1350 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1353 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1355 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1356 std::vector<double> val3;
1357 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1358 "Rotate2DAlg",2,true,nbNodes);
1360 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1361 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1364 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1367 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1368 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1369 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1370 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1371 for(int i=0;i<sz;i++)
1372 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1375 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1378 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1380 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1381 std::vector<double> val3;
1382 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1383 "Rotate3DAlg",3,true,nbNodes);
1385 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1386 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1387 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1392 //== MEDCouplingPointSet End
1394 class MEDCouplingUMeshCell
1397 INTERP_KERNEL::NormalizedCellType getType() const;
1400 std::string __str__() const throw(INTERP_KERNEL::Exception)
1402 return self->repr();
1405 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1408 const int *r=self->getAllConn(ret2);
1409 PyObject *ret=PyTuple_New(ret2);
1410 for(int i=0;i<ret2;i++)
1411 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1417 class MEDCouplingUMeshCellIterator
1424 MEDCouplingUMeshCell *ret=self->nextt();
1426 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1429 PyErr_SetString(PyExc_StopIteration,"No more data.");
1436 class MEDCouplingUMeshCellByTypeIterator
1439 ~MEDCouplingUMeshCellByTypeIterator();
1444 MEDCouplingUMeshCellEntry *ret=self->nextt();
1446 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1449 PyErr_SetString(PyExc_StopIteration,"No more data.");
1456 class MEDCouplingUMeshCellByTypeEntry
1459 ~MEDCouplingUMeshCellByTypeEntry();
1462 MEDCouplingUMeshCellByTypeIterator *__iter__()
1464 return self->iterator();
1469 class MEDCouplingUMeshCellEntry
1472 INTERP_KERNEL::NormalizedCellType getType() const;
1473 int getNumberOfElems() const;
1476 MEDCouplingUMeshCellIterator *__iter__()
1478 return self->iterator();
1483 //== MEDCouplingUMesh
1485 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1488 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1489 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1490 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1491 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1492 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1493 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1494 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1495 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1496 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1497 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1498 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1499 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1500 void computeTypes() throw(INTERP_KERNEL::Exception);
1501 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1502 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1504 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1505 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1506 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1507 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1508 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1509 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1510 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1511 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1512 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1513 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1514 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1515 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1516 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1517 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1518 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1519 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1520 bool isFullyQuadratic() const throw(INTERP_KERNEL::Exception);
1521 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1522 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1523 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1524 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1525 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1526 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1527 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1528 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1529 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1530 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1531 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1532 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1533 DataArrayDouble *computePlaneEquationOf3DFaces() const throw(INTERP_KERNEL::Exception);
1534 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1535 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1536 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1537 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1538 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1539 DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1540 DataArrayInt *buildUnionOf2DMesh() const throw(INTERP_KERNEL::Exception);
1541 DataArrayInt *buildUnionOf3DMesh() const throw(INTERP_KERNEL::Exception);
1542 DataArrayDouble *getBoundingBoxForBBTreeFast() const throw(INTERP_KERNEL::Exception);
1543 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1544 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1545 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1546 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1547 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1548 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1549 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1551 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1553 return MEDCouplingUMesh::New();
1556 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1558 return MEDCouplingUMesh::New(meshName,meshDim);
1561 std::string __str__() const throw(INTERP_KERNEL::Exception)
1563 return self->simpleRepr();
1566 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1568 std::ostringstream oss;
1569 self->reprQuickOverview(oss);
1573 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1575 return self->cellIterator();
1578 PyObject *getAllGeoTypesSorted() const throw(INTERP_KERNEL::Exception)
1580 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
1581 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1582 PyObject *res=PyList_New(result.size());
1583 for(int i=0;iL!=result.end(); i++, iL++)
1584 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1588 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1592 std::vector<int> multiVal;
1593 std::pair<int, std::pair<int,int> > slic;
1594 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1595 int nbc=self->getNumberOfCells();
1596 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1603 std::ostringstream oss;
1604 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1605 throw INTERP_KERNEL::Exception(oss.str().c_str());
1609 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1616 int tmp=nbc+singleVal;
1617 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1622 std::ostringstream oss;
1623 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1624 throw INTERP_KERNEL::Exception(oss.str().c_str());
1630 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1636 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1637 daIntTyypp->checkAllocated();
1638 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1642 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1646 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1650 std::vector<int> multiVal;
1651 std::pair<int, std::pair<int,int> > slic;
1652 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1653 int nbc=self->getNumberOfCells();
1654 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1661 std::ostringstream oss;
1662 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1663 throw INTERP_KERNEL::Exception(oss.str().c_str());
1667 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1674 int tmp=nbc+singleVal;
1675 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1680 std::ostringstream oss;
1681 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1682 throw INTERP_KERNEL::Exception(oss.str().c_str());
1688 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1693 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1699 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1700 daIntTyypp->checkAllocated();
1701 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1705 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1709 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1711 int szArr,sw,iTypppArr;
1712 std::vector<int> stdvecTyyppArr;
1713 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1716 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1717 throw INTERP_KERNEL::Exception(oss.str().c_str());
1719 self->insertNextCell(type,size,tmp);
1722 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1724 int szArr,sw,iTypppArr;
1725 std::vector<int> stdvecTyyppArr;
1726 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1727 self->insertNextCell(type,szArr,tmp);
1730 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1732 DataArrayInt *ret=self->getNodalConnectivity();
1737 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1739 DataArrayInt *ret=self->getNodalConnectivityIndex();
1745 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1747 int szArr,sw,iTypppArr;
1748 std::vector<int> stdvecTyyppArr;
1749 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1750 int nbOfDepthPeelingPerformed=0;
1751 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1752 PyObject *res=PyTuple_New(2);
1753 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1754 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1758 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1760 DataArrayInt *v0=0,*v1=0;
1761 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1762 PyObject *res = PyList_New(2);
1763 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1764 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1768 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1772 DataArrayDoubleTuple *aa;
1773 std::vector<double> bb;
1775 int nbOfCompo=self->getSpaceDimension();
1776 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1779 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1780 PyObject *ret=PyTuple_New(2);
1781 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1782 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1786 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1788 DataArrayInt *ret1=0;
1789 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1790 PyObject *ret=PyTuple_New(2);
1791 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1792 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1796 PyObject *tetrahedrize(int policy) throw(INTERP_KERNEL::Exception)
1799 DataArrayInt *ret1(0);
1800 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
1801 PyObject *ret=PyTuple_New(3);
1802 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
1803 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1804 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
1808 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1810 std::vector<int> cells;
1811 self->checkButterflyCells(cells,eps);
1812 DataArrayInt *ret=DataArrayInt::New();
1813 ret->alloc((int)cells.size(),1);
1814 std::copy(cells.begin(),cells.end(),ret->getPointer());
1815 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1818 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1820 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1822 PyObject *ret = PyList_New(sz);
1823 for(int i=0;i<sz;i++)
1824 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1828 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1830 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1831 int sz=retCpp.size();
1832 PyObject *ret=PyList_New(sz);
1833 for(int i=0;i<sz;i++)
1834 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1838 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1841 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1842 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1843 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1846 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1849 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1850 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1854 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1857 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1858 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1862 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1864 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1865 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1866 PyObject *ret=PyTuple_New(3);
1867 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1868 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1869 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1873 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1875 DataArrayInt *tmp0=0,*tmp1=0;
1876 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1877 PyObject *ret=PyTuple_New(2);
1878 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1879 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1883 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1887 std::vector<int> multiVal;
1888 std::pair<int, std::pair<int,int> > slic;
1889 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1890 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1894 return self->duplicateNodes(&singleVal,&singleVal+1);
1896 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
1898 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
1900 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1904 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
1908 std::vector<int> multiVal;
1909 std::pair<int, std::pair<int,int> > slic;
1910 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1911 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1915 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
1917 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
1919 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
1921 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1925 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
1928 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1929 DataArrayInt *tmp0,*tmp1=0;
1930 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
1931 PyObject *ret=PyTuple_New(2);
1932 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1933 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1937 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const throw(INTERP_KERNEL::Exception)
1939 DataArrayInt *ret0=0,*ret1=0;
1940 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
1941 PyObject *ret=PyTuple_New(2);
1942 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1943 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1947 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1949 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1950 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1951 DataArrayInt *ret1=0,*ret2=0;
1952 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
1953 PyObject *ret=PyTuple_New(3);
1954 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1955 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1956 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1960 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1962 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1963 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1964 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
1965 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1968 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
1971 std::vector<const MEDCouplingUMesh *> meshes;
1972 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1973 std::vector<DataArrayInt *> corr;
1974 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
1976 PyObject *ret1=PyList_New(sz);
1977 for(int i=0;i<sz;i++)
1978 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1979 PyObject *ret=PyList_New(2);
1980 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1981 PyList_SetItem(ret,1,ret1);
1985 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1987 std::vector<MEDCouplingUMesh *> meshes;
1988 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1989 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
1992 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
1994 std::vector<MEDCouplingUMesh *> meshes;
1995 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1996 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
1999 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
2003 std::vector<int> multiVal;
2004 std::pair<int, std::pair<int,int> > slic;
2005 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2007 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2008 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2012 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2014 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2016 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2018 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2022 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2024 DataArrayInt *arrOut=0,*arrIndexOut=0;
2027 std::vector<int> multiVal;
2028 std::pair<int, std::pair<int,int> > slic;
2029 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2031 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2032 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2037 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2042 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2047 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2051 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2053 PyObject *ret=PyTuple_New(2);
2054 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2055 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2059 static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2061 DataArrayInt *arrOut=0,*arrIndexOut=0;
2062 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2063 PyObject *ret=PyTuple_New(2);
2064 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2065 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2069 static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2071 if(!PySlice_Check(slic))
2072 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !");
2073 Py_ssize_t strt=2,stp=2,step=2;
2074 PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
2076 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !");
2077 arrIndxIn->checkAllocated();
2078 if(arrIndxIn->getNumberOfComponents()!=1)
2079 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !");
2080 if(PySlice_GetIndices(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step)!=0)
2081 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !");
2082 DataArrayInt *arrOut=0,*arrIndexOut=0;
2083 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2084 PyObject *ret=PyTuple_New(2);
2085 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2086 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2090 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2091 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2092 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2094 DataArrayInt *arrOut=0,*arrIndexOut=0;
2097 std::vector<int> multiVal;
2098 std::pair<int, std::pair<int,int> > slic;
2099 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2101 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2102 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2107 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2112 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2117 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2121 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2123 PyObject *ret=PyTuple_New(2);
2124 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2125 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2129 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2130 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2134 std::vector<int> multiVal;
2135 std::pair<int, std::pair<int,int> > slic;
2136 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2138 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2139 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2144 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2149 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2154 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2158 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2162 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2166 DataArrayDoubleTuple *aa;
2167 std::vector<double> bb;
2169 int spaceDim=self->getSpaceDimension();
2170 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2171 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2173 std::vector<int> cells;
2174 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2175 DataArrayInt *ret=DataArrayInt::New();
2176 ret->alloc((int)cells.size(),1);
2177 std::copy(cells.begin(),cells.end(),ret->getPointer());
2178 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2181 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2185 DataArrayDoubleTuple *aa;
2186 std::vector<double> bb;
2188 int spaceDim=self->getSpaceDimension();
2189 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2190 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2191 self->orientCorrectly2DCells(v,polyOnly);
2194 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2196 std::vector<int> cells;
2197 self->arePolyhedronsNotCorrectlyOriented(cells);
2198 DataArrayInt *ret=DataArrayInt::New();
2199 ret->alloc((int)cells.size(),1);
2200 std::copy(cells.begin(),cells.end(),ret->getPointer());
2201 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2204 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2208 self->getFastAveragePlaneOfThis(vec,pos);
2210 std::copy(vec,vec+3,vals);
2211 std::copy(pos,pos+3,vals+3);
2212 return convertDblArrToPyListOfTuple(vals,3,2);
2215 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2217 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2218 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2219 return MEDCouplingUMesh::MergeUMeshes(tmp);
2222 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2225 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2226 PyObject *ret=PyTuple_New(2);
2227 PyObject *ret0Py=ret0?Py_True:Py_False;
2229 PyTuple_SetItem(ret,0,ret0Py);
2230 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2234 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2237 bool ret0=self->areCellsIncludedIn2(other,ret1);
2238 PyObject *ret=PyTuple_New(2);
2239 PyObject *ret0Py=ret0?Py_True:Py_False;
2241 PyTuple_SetItem(ret,0,ret0Py);
2242 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2246 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2248 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2249 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2250 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2251 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2252 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2253 PyObject *ret=PyTuple_New(5);
2254 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2255 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2256 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2257 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2258 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2262 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2264 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2265 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2266 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2267 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2268 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2269 PyObject *ret=PyTuple_New(5);
2270 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2271 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2272 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2273 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2274 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2278 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2280 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2281 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2282 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2283 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2284 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2285 PyObject *ret=PyTuple_New(5);
2286 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2287 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2288 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2289 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2290 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2294 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2296 DataArrayInt *neighbors=0,*neighborsIdx=0;
2297 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2298 PyObject *ret=PyTuple_New(2);
2299 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2300 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2304 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2306 DataArrayInt *neighbors=0,*neighborsIdx=0;
2307 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2308 PyObject *ret=PyTuple_New(2);
2309 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2310 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2314 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2316 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2317 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2318 DataArrayInt *d2,*d3,*d4,*dd5;
2319 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2320 PyObject *ret=PyTuple_New(7);
2321 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2322 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2323 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2324 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2325 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2326 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2327 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2331 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2334 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2335 da->checkAllocated();
2336 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2339 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2342 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2343 da->checkAllocated();
2344 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2347 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2350 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2351 da->checkAllocated();
2352 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2355 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2358 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2359 da->checkAllocated();
2360 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2361 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2362 PyObject *res = PyList_New(result.size());
2363 for (int i=0;iL!=result.end(); i++, iL++)
2364 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2368 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2371 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2372 da->checkAllocated();
2373 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2374 ret->setName(da->getName().c_str());
2378 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2380 DataArrayInt *cellNb1=0,*cellNb2=0;
2381 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2382 PyObject *ret=PyTuple_New(3);
2383 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2384 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2385 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2389 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2391 int spaceDim=self->getSpaceDimension();
2393 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2395 DataArrayDouble *a,*a2;
2396 DataArrayDoubleTuple *aa,*aa2;
2397 std::vector<double> bb,bb2;
2399 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2400 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2401 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2402 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2404 DataArrayInt *cellIds=0;
2405 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2406 PyObject *ret=PyTuple_New(2);
2407 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2408 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2412 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2414 int spaceDim=self->getSpaceDimension();
2416 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2418 DataArrayDouble *a,*a2;
2419 DataArrayDoubleTuple *aa,*aa2;
2420 std::vector<double> bb,bb2;
2422 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2423 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2424 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2425 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2427 DataArrayInt *cellIds=0;
2428 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2429 PyObject *ret=PyTuple_New(2);
2430 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2431 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2435 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2437 int spaceDim=self->getSpaceDimension();
2439 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2441 DataArrayDouble *a,*a2;
2442 DataArrayDoubleTuple *aa,*aa2;
2443 std::vector<double> bb,bb2;
2445 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2446 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2447 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2448 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2449 return self->getCellIdsCrossingPlane(orig,vect,eps);
2452 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2456 std::vector<int> pos2;
2457 DataArrayInt *pos3=0;
2458 DataArrayIntTuple *pos4=0;
2459 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2464 self->convertToPolyTypes(&pos1,&pos1+1);
2471 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2476 self->convertToPolyTypes(pos3->begin(),pos3->end());
2480 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2484 void convertAllToPoly();
2485 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2486 bool unPolyze() throw(INTERP_KERNEL::Exception);
2487 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2488 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2489 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2492 //== MEDCouplingUMesh End
2494 //== MEDCouplingExtrudedMesh
2496 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2499 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2500 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2502 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2504 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2507 std::string __str__() const throw(INTERP_KERNEL::Exception)
2509 return self->simpleRepr();
2512 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2514 std::ostringstream oss;
2515 self->reprQuickOverview(oss);
2519 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2521 MEDCouplingUMesh *ret=self->getMesh2D();
2524 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2526 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2528 MEDCouplingUMesh *ret=self->getMesh1D();
2531 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2533 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2535 DataArrayInt *ret=self->getMesh3DIds();
2538 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2543 //== MEDCouplingExtrudedMesh End
2545 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2548 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2549 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2550 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2551 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2552 virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2553 virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
2556 virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2558 int szArr,sw,iTypppArr;
2559 std::vector<int> stdvecTyyppArr;
2560 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2561 self->insertNextCell(tmp,tmp+szArr);
2564 virtual DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2566 DataArrayInt *ret=self->getNodalConnectivity();
2567 if(ret) ret->incrRef();
2571 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2573 std::vector< const MEDCoupling1GTUMesh *> parts;
2574 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
2575 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
2580 //== MEDCoupling1SGTUMesh
2582 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2585 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2586 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2587 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2588 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2589 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2590 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2591 MEDCoupling1GTUMesh *computeDualMesh() const throw(INTERP_KERNEL::Exception);
2592 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const throw(INTERP_KERNEL::Exception);
2593 DataArrayInt *sortHexa8EachOther() throw(INTERP_KERNEL::Exception);
2596 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2598 return MEDCoupling1SGTUMesh::New(name,type);
2601 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2603 return MEDCoupling1SGTUMesh::New(m);
2606 std::string __str__() const throw(INTERP_KERNEL::Exception)
2608 return self->simpleRepr();
2611 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2613 std::ostringstream oss;
2614 self->reprQuickOverview(oss);
2618 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2620 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2621 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2622 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2625 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2627 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2628 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2629 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2634 //== MEDCoupling1SGTUMesh End
2636 //== MEDCoupling1DGTUMesh
2638 class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2641 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2642 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2643 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
2644 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2645 bool isPacked() const throw(INTERP_KERNEL::Exception);
2648 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2650 return MEDCoupling1DGTUMesh::New(name,type);
2653 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2655 return MEDCoupling1DGTUMesh::New(m);
2658 std::string __str__() const throw(INTERP_KERNEL::Exception)
2660 return self->simpleRepr();
2663 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2665 std::ostringstream oss;
2666 self->reprQuickOverview(oss);
2670 DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
2672 DataArrayInt *ret=self->getNodalConnectivityIndex();
2673 if(ret) ret->incrRef();
2677 PyObject *retrievePackedNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2679 DataArrayInt *ret1=0,*ret2=0;
2680 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
2681 PyObject *ret0Py=ret0?Py_True:Py_False;
2683 PyObject *ret=PyTuple_New(3);
2684 PyTuple_SetItem(ret,0,ret0Py);
2685 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2686 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2690 PyObject *copyWithNodalConnectivityPacked() const throw(INTERP_KERNEL::Exception)
2693 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
2694 PyObject *ret=PyTuple_New(2);
2695 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
2696 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
2697 PyTuple_SetItem(ret,1,ret1Py);
2701 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2703 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2704 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2705 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
2708 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2710 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2711 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2712 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
2715 static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt) throw(INTERP_KERNEL::Exception)
2717 std::vector<const ParaMEDMEM::DataArrayInt *> tmp;
2718 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2719 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
2724 //== MEDCoupling1DGTUMeshEnd
2726 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2729 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2730 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2731 virtual std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2732 std::vector<int> getCellGridStructure() const throw(INTERP_KERNEL::Exception);
2733 MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception);
2734 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
2737 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const throw(INTERP_KERNEL::Exception)
2739 int tmpp1=-1,tmpp2=-1;
2740 std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
2741 std::vector< std::pair<int,int> > inp;
2745 for(int i=0;i<tmpp1;i++)
2746 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2751 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
2752 inp.resize(tmpp1/2);
2753 for(int i=0;i<tmpp1/2;i++)
2754 { 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 !");
2758 return self->buildStructuredSubPart(inp);
2761 static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) throw(INTERP_KERNEL::Exception)
2763 int tmpp1=-1,tmpp2=-1;
2764 std::vector<int> tmp=fillArrayWithPyListInt2(part,tmpp1,tmpp2);
2765 std::vector< std::pair<int,int> > inp;
2769 for(int i=0;i<tmpp1;i++)
2770 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2775 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.BuildExplicitIdsFrom : invalid input size ! Must be even size !");
2776 inp.resize(tmpp1/2);
2777 for(int i=0;i<tmpp1/2;i++)
2778 { 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 !");
2783 int szArr,sw,iTypppArr;
2784 std::vector<int> stdvecTyyppArr;
2785 const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
2786 std::vector<int> tmp5(tmp4,tmp4+szArr);
2788 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
2791 static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) throw(INTERP_KERNEL::Exception)
2793 int szArr,sw,iTypppArr;
2794 std::vector<int> stdvecTyyppArr;
2795 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2796 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
2799 static PyObject *IsPartStructured(PyObject *li, PyObject *st) throw(INTERP_KERNEL::Exception)
2801 int szArr,sw,iTypppArr;
2802 std::vector<int> stdvecTyyppArr;
2803 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2804 int szArr2,sw2,iTypppArr2;
2805 std::vector<int> stdvecTyyppArr2;
2806 const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
2807 std::vector<int> tmp3(tmp2,tmp2+szArr2);
2808 std::vector< std::pair<int,int> > partCompactFormat;
2809 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
2810 PyObject *ret=PyTuple_New(2);
2811 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
2812 PyTuple_SetItem(ret,0,ret0Py);
2813 PyObject *ret1Py=PyList_New(partCompactFormat.size());
2814 for(std::size_t i=0;i<partCompactFormat.size();i++)
2816 PyObject *tmp4=PyTuple_New(2);
2817 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
2818 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
2819 PyList_SetItem(ret1Py,i,tmp4);
2821 PyTuple_SetItem(ret,1,ret1Py);
2827 //== MEDCouplingCMesh
2829 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2832 static MEDCouplingCMesh *New();
2833 static MEDCouplingCMesh *New(const std::string& meshName);
2834 MEDCouplingCMesh *clone(bool recDeepCpy) const;
2835 void setCoords(const DataArrayDouble *coordsX,
2836 const DataArrayDouble *coordsY=0,
2837 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
2838 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
2842 return MEDCouplingCMesh::New();
2844 MEDCouplingCMesh(const std::string& meshName)
2846 return MEDCouplingCMesh::New(meshName);
2848 std::string __str__() const throw(INTERP_KERNEL::Exception)
2850 return self->simpleRepr();
2852 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2854 std::ostringstream oss;
2855 self->reprQuickOverview(oss);
2858 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
2860 DataArrayDouble *ret=self->getCoordsAt(i);
2868 //== MEDCouplingCMesh End
2870 //== MEDCouplingCurveLinearMesh
2872 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2875 static MEDCouplingCurveLinearMesh *New();
2876 static MEDCouplingCurveLinearMesh *New(const std::string& meshName);
2877 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
2878 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
2880 MEDCouplingCurveLinearMesh()
2882 return MEDCouplingCurveLinearMesh::New();
2884 MEDCouplingCurveLinearMesh(const std::string& meshName)
2886 return MEDCouplingCurveLinearMesh::New(meshName);
2888 std::string __str__() const throw(INTERP_KERNEL::Exception)
2890 return self->simpleRepr();
2892 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2894 std::ostringstream oss;
2895 self->reprQuickOverview(oss);
2898 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
2900 DataArrayDouble *ret=self->getCoords();
2905 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
2907 int szArr,sw,iTypppArr;
2908 std::vector<int> stdvecTyyppArr;
2909 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
2910 self->setNodeGridStructure(tmp,tmp+szArr);
2915 //== MEDCouplingCurveLinearMesh End
2918 namespace ParaMEDMEM
2920 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
2923 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
2924 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
2925 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2926 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2927 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
2928 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
2929 void setName(const char *name) throw(INTERP_KERNEL::Exception);
2930 std::string getDescription() const throw(INTERP_KERNEL::Exception);
2931 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
2932 std::string getName() const throw(INTERP_KERNEL::Exception);
2933 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
2934 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
2935 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
2936 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
2937 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
2938 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
2939 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
2940 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
2941 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
2942 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
2943 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
2944 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
2945 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
2946 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
2947 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
2948 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
2950 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
2952 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
2955 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
2958 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
2960 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
2963 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
2966 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
2968 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
2969 return convertIntArrToPyList3(ret);
2972 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
2975 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
2976 PyObject *ret=PyTuple_New(2);
2977 PyObject *ret0Py=ret0?Py_True:Py_False;
2979 PyTuple_SetItem(ret,0,ret0Py);
2980 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2984 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
2986 DataArrayInt *ret1=0;
2987 MEDCouplingMesh *ret0=0;
2989 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2990 if (!SWIG_IsOK(res1))
2993 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2994 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
2998 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3000 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3001 da2->checkAllocated();
3002 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3004 PyObject *res = PyList_New(2);
3005 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3006 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3010 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
3012 DataArrayInt *ret1=0;
3014 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3015 PyObject *res=PyTuple_New(2);
3016 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3018 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3021 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3022 PyTuple_SetItem(res,1,res1);
3027 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3030 int v0; std::vector<int> v1;
3031 const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
3032 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3035 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3036 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3039 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3040 if (!SWIG_IsOK(res1))
3043 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3044 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3048 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3050 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3051 da2->checkAllocated();
3052 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3056 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3058 std::vector<int> tmp;
3059 self->getCellIdsHavingGaussLocalization(locId,tmp);
3060 DataArrayInt *ret=DataArrayInt::New();
3061 ret->alloc((int)tmp.size(),1);
3062 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3063 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3066 int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
3068 std::vector<int> inp0;
3069 convertPyToNewIntArr4(code,1,3,inp0);
3070 std::vector<const DataArrayInt *> inp1;
3071 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(idsPerType,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",inp1);
3072 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3077 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3080 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3081 static MEDCouplingFieldTemplate *New(TypeOfField type);
3082 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3083 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3086 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3088 return MEDCouplingFieldTemplate::New(f);
3091 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3093 return MEDCouplingFieldTemplate::New(type);
3096 std::string __str__() const throw(INTERP_KERNEL::Exception)
3098 return self->simpleRepr();
3101 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3103 std::ostringstream oss;
3104 self->reprQuickOverview(oss);
3110 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3113 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3114 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3115 void setTimeUnit(const std::string& unit);
3116 std::string getTimeUnit() const;
3117 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3118 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3119 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3120 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3121 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3122 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
3123 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3124 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3125 MEDCouplingFieldDouble *deepCpy() const;
3126 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3127 MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
3128 MEDCouplingFieldDouble *cellToNodeDiscretization() const throw(INTERP_KERNEL::Exception);
3129 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3130 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3131 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3132 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3133 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3134 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3135 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3136 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3137 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3138 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3139 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3140 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3141 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3142 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3143 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3144 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3145 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3146 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3147 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3148 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3149 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3150 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3151 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3152 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3153 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3154 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3155 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3156 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3157 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3158 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3159 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3160 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3161 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3162 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3163 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3164 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3165 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3166 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3167 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3168 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3169 void fillFromAnalytic(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3170 void fillFromAnalytic2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3171 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3172 void applyFunc(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3173 void applyFunc2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3174 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3175 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3176 void applyFunc(const std::string& func) throw(INTERP_KERNEL::Exception);
3177 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
3178 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
3179 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3180 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3181 double getMinValue() const throw(INTERP_KERNEL::Exception);
3182 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3183 double norm2() const throw(INTERP_KERNEL::Exception);
3184 double normMax() const throw(INTERP_KERNEL::Exception);
3185 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3186 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3187 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3188 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3189 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3190 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3191 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3192 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3193 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3194 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3195 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3196 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3197 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3198 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3199 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3200 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3201 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3202 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3203 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3204 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3205 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3206 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3208 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3210 return MEDCouplingFieldDouble::New(type,td);
3213 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3215 return MEDCouplingFieldDouble::New(ft,td);
3218 std::string __str__() const throw(INTERP_KERNEL::Exception)
3220 return self->simpleRepr();
3223 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3225 std::ostringstream oss;
3226 self->reprQuickOverview(oss);
3230 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3232 DataArrayDouble *ret=self->getArray();
3238 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3240 std::vector<DataArrayDouble *> arrs=self->getArrays();
3241 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3245 PyObject *ret=PyTuple_New(sz);
3246 for(int i=0;i<sz;i++)
3249 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3251 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3256 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3258 std::vector<const DataArrayDouble *> tmp;
3259 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3261 std::vector<DataArrayDouble *> arrs(sz);
3262 for(int i=0;i<sz;i++)
3263 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3264 self->setArrays(arrs);
3267 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3269 DataArrayDouble *ret=self->getEndArray();
3275 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3279 DataArrayDoubleTuple *aa;
3280 std::vector<double> bb;
3282 const MEDCouplingMesh *mesh=self->getMesh();
3284 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3285 int spaceDim=mesh->getSpaceDimension();
3286 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3287 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3289 int sz=self->getNumberOfComponents();
3290 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3291 self->getValueOn(spaceLoc,res);
3292 return convertDblArrToPyList(res,sz);
3295 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3297 int sz=self->getNumberOfComponents();
3298 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3299 self->getValueOnPos(i,j,k,res);
3300 return convertDblArrToPyList(res,sz);
3303 DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
3305 const MEDCouplingMesh *mesh(self->getMesh());
3307 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3310 double v0; ParaMEDMEM::DataArrayDouble *v1(0); ParaMEDMEM::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
3311 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
3312 mesh->getSpaceDimension(),true,nbPts);
3313 return self->getValueOnMulti(inp,nbPts);
3316 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3320 DataArrayDoubleTuple *aa;
3321 std::vector<double> bb;
3323 const MEDCouplingMesh *mesh=self->getMesh();
3325 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3326 int spaceDim=mesh->getSpaceDimension();
3327 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3328 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3331 int sz=self->getNumberOfComponents();
3332 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3333 self->getValueOn(spaceLoc,time,res);
3334 return convertDblArrToPyList(res,sz);
3337 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3339 if(self->getArray()!=0)
3340 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3343 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3344 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3345 self->setArray(arr);
3349 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3352 double tmp0=self->getTime(tmp1,tmp2);
3353 PyObject *res = PyList_New(3);
3354 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3355 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3356 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3360 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3363 double tmp0=self->getStartTime(tmp1,tmp2);
3364 PyObject *res = PyList_New(3);
3365 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3366 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3367 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3371 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3374 double tmp0=self->getEndTime(tmp1,tmp2);
3375 PyObject *res = PyList_New(3);
3376 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3377 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3378 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3381 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3383 int sz=self->getNumberOfComponents();
3384 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3385 self->accumulate(tmp);
3386 return convertDblArrToPyList(tmp,sz);
3388 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3390 int sz=self->getNumberOfComponents();
3391 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3392 self->integral(isWAbs,tmp);
3393 return convertDblArrToPyList(tmp,sz);
3395 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3397 int sz=self->getNumberOfComponents();
3398 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3399 self->getWeightedAverageValue(tmp,isWAbs);
3400 return convertDblArrToPyList(tmp,sz);
3402 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3404 int sz=self->getNumberOfComponents();
3405 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3407 return convertDblArrToPyList(tmp,sz);
3409 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3411 int sz=self->getNumberOfComponents();
3412 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3414 return convertDblArrToPyList(tmp,sz);
3416 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3418 int szArr,sw,iTypppArr;
3419 std::vector<int> stdvecTyyppArr;
3420 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3421 self->renumberCells(tmp,check);
3424 void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3426 int szArr,sw,iTypppArr;
3427 std::vector<int> stdvecTyyppArr;
3428 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3429 self->renumberCellsWithoutMesh(tmp,check);
3432 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3434 int szArr,sw,iTypppArr;
3435 std::vector<int> stdvecTyyppArr;
3436 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3437 self->renumberNodes(tmp,eps);
3440 void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3442 int szArr,sw,iTypppArr;
3443 std::vector<int> stdvecTyyppArr;
3444 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3445 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
3448 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3452 std::vector<int> multiVal;
3453 std::pair<int, std::pair<int,int> > slic;
3454 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3455 const MEDCouplingMesh *mesh=self->getMesh();
3457 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3458 int nbc=mesh->getNumberOfCells();
3459 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3466 std::ostringstream oss;
3467 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3468 throw INTERP_KERNEL::Exception(oss.str().c_str());
3471 return self->buildSubPart(&singleVal,&singleVal+1);
3476 int tmp=nbc+singleVal;
3477 return self->buildSubPart(&tmp,&tmp+1);
3481 std::ostringstream oss;
3482 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3483 throw INTERP_KERNEL::Exception(oss.str().c_str());
3489 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3493 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3498 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3499 daIntTyypp->checkAllocated();
3500 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3503 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3507 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3509 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";
3510 if(PyTuple_Check(li))
3512 Py_ssize_t sz=PyTuple_Size(li);
3514 throw INTERP_KERNEL::Exception(msg);
3515 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3518 std::vector<int> multiVal;
3519 std::pair<int, std::pair<int,int> > slic;
3520 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3521 if(!self->getArray())
3522 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3524 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3525 catch(INTERP_KERNEL::Exception& e)
3526 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3527 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3528 DataArrayDouble *ret0Arr=ret0->getArray();
3530 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3535 std::vector<int> v2(1,singleVal);
3536 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3537 ret0->setArray(aarr);
3542 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3543 ret0->setArray(aarr);
3548 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3549 std::vector<int> v2(nbOfComp);
3550 for(int i=0;i<nbOfComp;i++)
3551 v2[i]=slic.first+i*slic.second.second;
3552 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3553 ret0->setArray(aarr);
3557 throw INTERP_KERNEL::Exception(msg);
3562 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3565 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3568 double r1=self->getMaxValue2(tmp);
3569 PyObject *ret=PyTuple_New(2);
3570 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3571 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3575 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3578 double r1=self->getMinValue2(tmp);
3579 PyObject *ret=PyTuple_New(2);
3580 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3581 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3585 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3587 std::vector<int> tmp;
3588 convertPyToNewIntArr3(li,tmp);
3589 return self->keepSelectedComponents(tmp);
3592 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3594 std::vector<int> tmp;
3595 convertPyToNewIntArr3(li,tmp);
3596 self->setSelectedComponents(f,tmp);
3599 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3602 DataArrayDouble *a,*a2;
3603 DataArrayDoubleTuple *aa,*aa2;
3604 std::vector<double> bb,bb2;
3607 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
3608 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
3609 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3610 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3612 return self->extractSlice3D(orig,vect,eps);
3615 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3617 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
3620 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3622 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
3625 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3627 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.";
3628 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
3631 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3633 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3635 return (*self)-(*other);
3637 throw INTERP_KERNEL::Exception(msg);
3642 DataArrayDoubleTuple *aa;
3643 std::vector<double> bb;
3645 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3650 if(!self->getArray())
3651 throw INTERP_KERNEL::Exception(msg2);
3652 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3653 ret->applyLin(1.,-val);
3654 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3655 ret2->setArray(ret);
3660 if(!self->getArray())
3661 throw INTERP_KERNEL::Exception(msg2);
3662 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
3663 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3664 ret2->setArray(ret);
3669 if(!self->getArray())
3670 throw INTERP_KERNEL::Exception(msg2);
3671 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3672 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3673 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3674 ret2->setArray(ret);
3679 if(!self->getArray())
3680 throw INTERP_KERNEL::Exception(msg2);
3681 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3682 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3683 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3684 ret2->setArray(ret);
3688 { throw INTERP_KERNEL::Exception(msg); }
3692 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3694 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
3697 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3699 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
3702 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3704 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
3707 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3709 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.";
3710 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
3713 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3715 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3717 return (*self)/(*other);
3719 throw INTERP_KERNEL::Exception(msg);
3724 DataArrayDoubleTuple *aa;
3725 std::vector<double> bb;
3727 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3733 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
3734 if(!self->getArray())
3735 throw INTERP_KERNEL::Exception(msg2);
3736 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3737 ret->applyLin(1./val,0);
3738 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3739 ret2->setArray(ret);
3744 if(!self->getArray())
3745 throw INTERP_KERNEL::Exception(msg2);
3746 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
3747 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3748 ret2->setArray(ret);
3753 if(!self->getArray())
3754 throw INTERP_KERNEL::Exception(msg2);
3755 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3756 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3757 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3758 ret2->setArray(ret);
3763 if(!self->getArray())
3764 throw INTERP_KERNEL::Exception(msg2);
3765 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3766 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3767 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3768 ret2->setArray(ret);
3772 { throw INTERP_KERNEL::Exception(msg); }
3776 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3778 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
3781 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3783 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.";
3784 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
3787 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3789 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3791 return (*self)^(*other);
3793 throw INTERP_KERNEL::Exception(msg);
3798 DataArrayDoubleTuple *aa;
3799 std::vector<double> bb;
3801 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3806 if(!self->getArray())
3807 throw INTERP_KERNEL::Exception(msg2);
3808 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3810 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3811 ret2->setArray(ret);
3816 if(!self->getArray())
3817 throw INTERP_KERNEL::Exception(msg2);
3818 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
3819 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3820 ret2->setArray(ret);
3825 if(!self->getArray())
3826 throw INTERP_KERNEL::Exception(msg2);
3827 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3828 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3829 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3830 ret2->setArray(ret);
3835 if(!self->getArray())
3836 throw INTERP_KERNEL::Exception(msg2);
3837 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3838 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3839 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3840 ret2->setArray(ret);
3844 { throw INTERP_KERNEL::Exception(msg); }
3848 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
3850 return self->negate();
3853 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3855 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.";
3856 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
3859 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3861 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3865 Py_XINCREF(trueSelf);
3869 throw INTERP_KERNEL::Exception(msg);
3874 DataArrayDoubleTuple *aa;
3875 std::vector<double> bb;
3877 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3882 if(!self->getArray())
3883 throw INTERP_KERNEL::Exception(msg2);
3884 self->getArray()->applyLin(1.,val);
3885 Py_XINCREF(trueSelf);
3890 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3893 Py_XINCREF(trueSelf);
3898 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3899 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3900 ret2->setArray(aaa);
3902 Py_XINCREF(trueSelf);
3907 if(!self->getArray())
3908 throw INTERP_KERNEL::Exception(msg2);
3909 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3910 self->getArray()->addEqual(aaa);
3911 Py_XINCREF(trueSelf);
3915 { throw INTERP_KERNEL::Exception(msg); }
3919 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3921 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.";
3922 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
3925 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3927 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3931 Py_XINCREF(trueSelf);
3935 throw INTERP_KERNEL::Exception(msg);
3940 DataArrayDoubleTuple *aa;
3941 std::vector<double> bb;
3943 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3948 if(!self->getArray())
3949 throw INTERP_KERNEL::Exception(msg2);
3950 self->getArray()->applyLin(1.,-val);
3951 Py_XINCREF(trueSelf);
3956 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3959 Py_XINCREF(trueSelf);
3964 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3965 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3966 ret2->setArray(aaa);
3968 Py_XINCREF(trueSelf);
3973 if(!self->getArray())
3974 throw INTERP_KERNEL::Exception(msg2);
3975 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3976 self->getArray()->substractEqual(aaa);
3977 Py_XINCREF(trueSelf);
3981 { throw INTERP_KERNEL::Exception(msg); }
3985 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3987 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.";
3988 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
3991 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3993 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3997 Py_XINCREF(trueSelf);
4001 throw INTERP_KERNEL::Exception(msg);
4006 DataArrayDoubleTuple *aa;
4007 std::vector<double> bb;
4009 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4014 if(!self->getArray())
4015 throw INTERP_KERNEL::Exception(msg2);
4016 self->getArray()->applyLin(val,0);
4017 Py_XINCREF(trueSelf);
4022 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4025 Py_XINCREF(trueSelf);
4030 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4031 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4032 ret2->setArray(aaa);
4034 Py_XINCREF(trueSelf);
4039 if(!self->getArray())
4040 throw INTERP_KERNEL::Exception(msg2);
4041 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4042 self->getArray()->multiplyEqual(aaa);
4043 Py_XINCREF(trueSelf);
4047 { throw INTERP_KERNEL::Exception(msg); }
4051 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4053 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.";
4054 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4057 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4059 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4063 Py_XINCREF(trueSelf);
4067 throw INTERP_KERNEL::Exception(msg);
4072 DataArrayDoubleTuple *aa;
4073 std::vector<double> bb;
4075 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4081 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4082 if(!self->getArray())
4083 throw INTERP_KERNEL::Exception(msg2);
4084 self->getArray()->applyLin(1./val,0);
4085 Py_XINCREF(trueSelf);
4090 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4093 Py_XINCREF(trueSelf);
4098 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4099 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4100 ret2->setArray(aaa);
4102 Py_XINCREF(trueSelf);
4107 if(!self->getArray())
4108 throw INTERP_KERNEL::Exception(msg2);
4109 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4110 self->getArray()->divideEqual(aaa);
4111 Py_XINCREF(trueSelf);
4115 { throw INTERP_KERNEL::Exception(msg); }
4119 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4121 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.";
4122 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4125 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4127 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4131 Py_XINCREF(trueSelf);
4135 throw INTERP_KERNEL::Exception(msg);
4140 DataArrayDoubleTuple *aa;
4141 std::vector<double> bb;
4143 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4148 if(!self->getArray())
4149 throw INTERP_KERNEL::Exception(msg2);
4150 self->getArray()->applyPow(val);
4151 Py_XINCREF(trueSelf);
4156 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4159 Py_XINCREF(trueSelf);
4164 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4165 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4166 ret2->setArray(aaa);
4168 Py_XINCREF(trueSelf);
4173 if(!self->getArray())
4174 throw INTERP_KERNEL::Exception(msg2);
4175 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4176 self->getArray()->powEqual(aaa);
4177 Py_XINCREF(trueSelf);
4181 { throw INTERP_KERNEL::Exception(msg); }
4185 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4187 std::vector<const MEDCouplingFieldDouble *> tmp;
4188 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4189 return MEDCouplingFieldDouble::MergeFields(tmp);
4192 static void WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
4194 std::vector<const MEDCouplingFieldDouble *> tmp;
4195 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4196 MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4201 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4204 int getNumberOfFields() const;
4205 MEDCouplingMultiFields *deepCpy() const;
4206 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4207 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4208 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4209 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4210 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4213 std::string __str__() const throw(INTERP_KERNEL::Exception)
4215 return self->simpleRepr();
4217 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4219 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4220 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4222 std::vector<MEDCouplingFieldDouble *> fs(sz);
4223 for(int i=0;i<sz;i++)
4224 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4225 return MEDCouplingMultiFields::New(fs);
4227 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4229 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4230 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4232 std::vector<MEDCouplingFieldDouble *> fs(sz);
4233 for(int i=0;i<sz;i++)
4234 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4235 return MEDCouplingMultiFields::New(fs);
4237 PyObject *getFields() const
4239 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4240 int sz=fields.size();
4241 PyObject *res = PyList_New(sz);
4242 for(int i=0;i<sz;i++)
4246 fields[i]->incrRef();
4247 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4251 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4256 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4258 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4262 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4265 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4267 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4269 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4271 PyObject *res = PyList_New(sz);
4272 for(int i=0;i<sz;i++)
4277 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4281 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4286 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4288 std::vector<int> refs;
4289 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4291 PyObject *res = PyList_New(sz);
4292 for(int i=0;i<sz;i++)
4297 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4301 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4305 PyObject *ret=PyTuple_New(2);
4306 PyTuple_SetItem(ret,0,res);
4307 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4310 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4312 std::vector<DataArrayDouble *> ms=self->getArrays();
4314 PyObject *res = PyList_New(sz);
4315 for(int i=0;i<sz;i++)
4320 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4324 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4329 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4331 std::vector< std::vector<int> > refs;
4332 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4334 PyObject *res = PyList_New(sz);
4335 PyObject *res2 = PyList_New(sz);
4336 for(int i=0;i<sz;i++)
4341 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4345 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4347 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4350 PyObject *ret=PyTuple_New(2);
4351 PyTuple_SetItem(ret,0,res);
4352 PyTuple_SetItem(ret,1,res2);
4358 class MEDCouplingDefinitionTime
4361 MEDCouplingDefinitionTime();
4362 void assign(const MEDCouplingDefinitionTime& other);
4363 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4364 double getTimeResolution() const;
4365 std::vector<double> getHotSpotsTime() const;
4368 std::string __str__() const throw(INTERP_KERNEL::Exception)
4370 std::ostringstream oss;
4371 self->appendRepr(oss);
4375 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4377 int meshId,arrId,arrIdInField,fieldId;
4378 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4379 PyObject *res=PyList_New(4);
4380 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4381 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4382 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4383 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4387 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4389 int meshId,arrId,arrIdInField,fieldId;
4390 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4391 PyObject *res=PyList_New(4);
4392 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4393 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4394 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4395 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4401 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4404 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4405 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4409 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4411 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4412 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4414 std::vector<MEDCouplingFieldDouble *> fs(sz);
4415 for(int i=0;i<sz;i++)
4416 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4417 return MEDCouplingFieldOverTime::New(fs);
4419 std::string __str__() const throw(INTERP_KERNEL::Exception)
4421 return self->simpleRepr();
4423 static MEDCouplingFieldOverTime *New(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);
4439 __filename=os.environ.get('PYTHONSTARTUP')
4440 if __filename and os.path.isfile(__filename):
4441 execfile(__filename)