1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
27 #include "MEDCouplingMemArray.hxx"
28 #include "MEDCouplingUMesh.hxx"
29 #include "MEDCouplingExtrudedMesh.hxx"
30 #include "MEDCouplingCMesh.hxx"
31 #include "MEDCouplingCurveLinearMesh.hxx"
32 #include "MEDCoupling1GTUMesh.hxx"
33 #include "MEDCouplingField.hxx"
34 #include "MEDCouplingFieldDouble.hxx"
35 #include "MEDCouplingFieldTemplate.hxx"
36 #include "MEDCouplingGaussLocalization.hxx"
37 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
38 #include "MEDCouplingMultiFields.hxx"
39 #include "MEDCouplingFieldOverTime.hxx"
40 #include "MEDCouplingDefinitionTime.hxx"
41 #include "MEDCouplingFieldDiscretization.hxx"
42 #include "MEDCouplingTypemaps.i"
44 #include "InterpKernelAutoPtr.hxx"
46 using namespace ParaMEDMEM;
47 using namespace INTERP_KERNEL;
51 %template(ivec) std::vector<int>;
52 %template(dvec) std::vector<double>;
53 %template(svec) std::vector<std::string>;
56 %typemap(out) ParaMEDMEM::MEDCouplingMesh*
58 $result=convertMesh($1,$owner);
61 %typemap(out) MEDCouplingMesh*
63 $result=convertMesh($1,$owner);
68 %typemap(out) ParaMEDMEM::MEDCouplingPointSet*
70 $result=convertMesh($1,$owner);
73 %typemap(out) MEDCouplingPointSet*
75 $result=convertMesh($1,$owner);
81 %typemap(out) ParaMEDMEM::MEDCoupling1GTUMesh*
83 $result=convertMesh($1,$owner);
86 %typemap(out) MEDCoupling1GTUMesh*
88 $result=convertMesh($1,$owner);
93 %typemap(out) ParaMEDMEM::MEDCouplingStructuredMesh*
95 $result=convertMesh($1,$owner);
98 %typemap(out) MEDCouplingStructuredMesh*
100 $result=convertMesh($1,$owner);
105 %typemap(out) ParaMEDMEM::MEDCouplingFieldDiscretization*
107 $result=convertFieldDiscretization($1,$owner);
110 %typemap(out) MEDCouplingFieldDiscretization*
112 $result=convertFieldDiscretization($1,$owner);
117 %typemap(out) ParaMEDMEM::MEDCouplingMultiFields*
119 $result=convertMultiFields($1,$owner);
122 %typemap(out) MEDCouplingMultiFields*
124 $result=convertMultiFields($1,$owner);
129 %init %{ import_array(); %}
132 %feature("autodoc", "1");
133 %feature("docstring");
135 %newobject ParaMEDMEM::MEDCouplingField::buildMeasureField;
136 %newobject ParaMEDMEM::MEDCouplingField::getLocalizationOfDiscr;
137 %newobject ParaMEDMEM::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
138 %newobject ParaMEDMEM::MEDCouplingFieldDouble::New;
139 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getArray;
140 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getEndArray;
141 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MergeFields;
142 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MeldFields;
143 %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct;
144 %newobject ParaMEDMEM::MEDCouplingFieldDouble::determinant;
145 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenValues;
146 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenVectors;
147 %newobject ParaMEDMEM::MEDCouplingFieldDouble::inverse;
148 %newobject ParaMEDMEM::MEDCouplingFieldDouble::trace;
149 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deviator;
150 %newobject ParaMEDMEM::MEDCouplingFieldDouble::magnitude;
151 %newobject ParaMEDMEM::MEDCouplingFieldDouble::maxPerTuple;
152 %newobject ParaMEDMEM::MEDCouplingFieldDouble::keepSelectedComponents;
153 %newobject ParaMEDMEM::MEDCouplingFieldDouble::extractSlice3D;
154 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DotFields;
155 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dot;
156 %newobject ParaMEDMEM::MEDCouplingFieldDouble::CrossProductFields;
157 %newobject ParaMEDMEM::MEDCouplingFieldDouble::crossProduct;
158 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MaxFields;
159 %newobject ParaMEDMEM::MEDCouplingFieldDouble::max;
160 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MinFields;
161 %newobject ParaMEDMEM::MEDCouplingFieldDouble::AddFields;
162 %newobject ParaMEDMEM::MEDCouplingFieldDouble::SubstractFields;
163 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MultiplyFields;
164 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DivideFields;
165 %newobject ParaMEDMEM::MEDCouplingFieldDouble::min;
166 %newobject ParaMEDMEM::MEDCouplingFieldDouble::negate;
167 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getIdsInRange;
168 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart;
169 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPartRange;
170 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__getitem__;
171 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__neg__;
172 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__add__;
173 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__sub__;
174 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__mul__;
175 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__div__;
176 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__pow__;
177 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__radd__;
178 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rsub__;
179 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rmul__;
180 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rdiv__;
181 %newobject ParaMEDMEM::MEDCouplingFieldDouble::clone;
182 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cloneWithMesh;
183 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy;
184 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
185 %newobject ParaMEDMEM::MEDCouplingFieldDouble::nodeToCellDiscretization;
186 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cellToNodeDiscretization;
187 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
188 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
189 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
190 %newobject ParaMEDMEM::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
191 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
192 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfNodesPerCell;
193 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfFacesPerCell;
194 %newobject ParaMEDMEM::MEDCouplingMesh::computeEffectiveNbOfNodesPerCell;
195 %newobject ParaMEDMEM::MEDCouplingMesh::buildPartRange;
196 %newobject ParaMEDMEM::MEDCouplingMesh::giveCellsWithType;
197 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
198 %newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
199 %newobject ParaMEDMEM::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
200 %newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
201 %newobject ParaMEDMEM::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
202 %newobject ParaMEDMEM::MEDCouplingMesh::mergeMyselfWith;
203 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic;
204 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic2;
205 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic3;
206 %newobject ParaMEDMEM::MEDCouplingMesh::getMeasureField;
207 %newobject ParaMEDMEM::MEDCouplingMesh::simplexize;
208 %newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured;
209 %newobject ParaMEDMEM::MEDCouplingMesh::MergeMeshes;
210 %newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer;
211 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellsInBoundingBox;
212 %newobject ParaMEDMEM::MEDCouplingPointSet::findBoundaryNodes;
213 %newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh;
214 %newobject ParaMEDMEM::MEDCouplingPointSet::MergeNodesArray;
215 %newobject ParaMEDMEM::MEDCouplingPointSet::buildPartOfMySelf2;
216 %newobject ParaMEDMEM::MEDCouplingPointSet::BuildInstanceFromMeshType;
217 %newobject ParaMEDMEM::MEDCouplingPointSet::zipConnectivityTraducer;
218 %newobject ParaMEDMEM::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
219 %newobject ParaMEDMEM::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
220 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellIdsLyingOnNodes;
221 %newobject ParaMEDMEM::MEDCouplingPointSet::deepCpyConnectivityOnly;
222 %newobject ParaMEDMEM::MEDCouplingPointSet::getBoundingBoxForBBTree;
223 %newobject ParaMEDMEM::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells;
224 %newobject ParaMEDMEM::MEDCouplingPointSet::__getitem__;
225 %newobject ParaMEDMEM::MEDCouplingUMesh::New;
226 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
227 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
228 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
229 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
230 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
231 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
232 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
233 %newobject ParaMEDMEM::MEDCouplingUMesh::explode3DMeshTo1D;
234 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
235 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
236 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
237 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
238 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
239 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
240 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
241 %newobject ParaMEDMEM::MEDCouplingUMesh::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::MEDCouplingUMeshCellByTypeEntry::__iter__;
274 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
275 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::New;
276 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::getNodalConnectivity;
277 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
278 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::New;
279 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
280 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::computeDualMesh;
281 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
282 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::sortHexa8EachOther;
283 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
284 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
285 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::New;
286 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
287 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
288 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
289 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
290 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
291 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
292 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::buildStructuredSubPart;
293 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTUnstructured;
294 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
295 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
296 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
297 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
298 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
299 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
300 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
301 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
302 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
303 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
304 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
306 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
307 %feature("unref") MEDCouplingMesh "$this->decrRef();"
308 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
309 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
310 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
311 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
312 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
313 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
314 %feature("unref") MEDCouplingField "$this->decrRef();"
315 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
316 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
317 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
318 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
319 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
320 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
321 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
322 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
323 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
325 %rename(assign) *::operator=;
326 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
327 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
328 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
329 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
333 %rename (InterpKernelException) INTERP_KERNEL::Exception;
335 %include "MEDCouplingRefCountObject.i"
336 %include "MEDCouplingMemArray.i"
354 CONST_ON_TIME_INTERVAL = 7
355 } TypeOfTimeDiscretization;
363 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
364 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11
365 } MEDCouplingMeshType;
368 class DataArrayDouble;
369 class MEDCouplingUMesh;
370 class MEDCouplingFieldDouble;
372 %extend RefCountObject
374 std::string getHiddenCppPointer() const
376 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
381 %extend MEDCouplingGaussLocalization
383 std::string __str__() const throw(INTERP_KERNEL::Exception)
385 return self->getStringRepr();
388 std::string __repr__() const throw(INTERP_KERNEL::Exception)
390 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
391 oss << self->getStringRepr();
398 class MEDCouplingMesh : public RefCountObject, public TimeLabel
401 void setName(const std::string& name);
402 std::string getName() const;
403 void setDescription(const std::string& descr);
404 std::string getDescription() const;
405 void setTime(double val, int iteration, int order);
406 void setTimeUnit(const std::string& unit);
407 std::string getTimeUnit() const;
408 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
409 bool isStructured() const throw(INTERP_KERNEL::Exception);
410 virtual MEDCouplingMesh *deepCpy() const;
411 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
412 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
413 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
414 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
415 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
416 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
417 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
418 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
419 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
420 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
421 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
422 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
423 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
424 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
425 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
426 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
427 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
428 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
429 virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
430 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
431 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
432 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
433 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
434 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
435 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
437 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
438 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
439 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
440 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
441 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception);
442 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
443 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
444 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
445 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
446 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
447 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
448 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
449 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
450 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
451 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
452 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
453 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
456 std::string __str__() const throw(INTERP_KERNEL::Exception)
458 return self->simpleRepr();
461 PyObject *getTime() throw(INTERP_KERNEL::Exception)
464 double tmp0=self->getTime(tmp1,tmp2);
465 PyObject *res = PyList_New(3);
466 PyList_SetItem(res,0,SWIG_From_double(tmp0));
467 PyList_SetItem(res,1,SWIG_From_int(tmp1));
468 PyList_SetItem(res,2,SWIG_From_int(tmp2));
472 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
476 DataArrayDoubleTuple *aa;
477 std::vector<double> bb;
479 int spaceDim=self->getSpaceDimension();
480 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
481 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
482 return self->getCellContainingPoint(pos,eps);
485 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
489 DataArrayDoubleTuple *aa;
490 std::vector<double> bb;
492 int spaceDim=self->getSpaceDimension();
493 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
494 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
495 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
496 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
497 PyObject *ret=PyTuple_New(2);
498 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
499 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
503 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
505 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
506 int spaceDim=self->getSpaceDimension();
508 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
509 if (!SWIG_IsOK(res1))
512 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
513 int nbOfPoints=size/spaceDim;
516 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
518 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
522 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
524 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
525 da2->checkAllocated();
526 int size=da2->getNumberOfTuples();
527 int nbOfCompo=da2->getNumberOfComponents();
528 if(nbOfCompo!=spaceDim)
530 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
532 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
534 PyObject *ret=PyTuple_New(2);
535 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
536 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
540 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
544 DataArrayDoubleTuple *aa;
545 std::vector<double> bb;
547 int spaceDim=self->getSpaceDimension();
548 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
549 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
550 std::vector<int> elts;
551 self->getCellsContainingPoint(pos,eps,elts);
552 DataArrayInt *ret=DataArrayInt::New();
553 ret->alloc((int)elts.size(),1);
554 std::copy(elts.begin(),elts.end(),ret->getPointer());
555 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
558 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
560 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
561 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
562 self->getReverseNodalConnectivity(d0,d1);
563 PyObject *ret=PyTuple_New(2);
564 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
565 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
569 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
572 int v0; std::vector<int> v1;
573 const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
574 self->renumberCells(ids,check);
577 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
579 DataArrayInt *cellCor, *nodeCor;
580 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
581 PyObject *res = PyList_New(2);
582 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
583 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
587 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
589 DataArrayInt *cellCor=0,*nodeCor=0;
590 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
591 PyObject *res = PyList_New(2);
592 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
593 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
597 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
599 DataArrayInt *cellCor=0;
600 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
604 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
607 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
608 if (!SWIG_IsOK(res1))
611 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
612 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
616 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
618 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
619 da2->checkAllocated();
620 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
623 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
625 std::vector<int> conn;
626 self->getNodeIdsOfCell(cellId,conn);
627 return convertIntArrToPyList2(conn);
630 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
632 std::vector<double> coo;
633 self->getCoordinatesOfNode(nodeId,coo);
634 return convertDblArrToPyList2(coo);
637 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
641 DataArrayDoubleTuple *aa;
642 std::vector<double> bb;
644 int spaceDim=self->getSpaceDimension();
645 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
646 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
647 self->scale(pointPtr,factor);
650 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
652 int spaceDim=self->getSpaceDimension();
653 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
654 self->getBoundingBox(tmp);
655 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
659 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
662 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
663 PyObject *ret=PyTuple_New(2);
664 PyObject *ret0Py=ret0?Py_True:Py_False;
666 PyTuple_SetItem(ret,0,ret0Py);
667 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
671 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
673 int szArr,sw,iTypppArr;
674 std::vector<int> stdvecTyyppArr;
675 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
676 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
677 if(sw==3)//DataArrayInt
679 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
680 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
681 std::string name=argpt->getName();
683 ret->setName(name.c_str());
685 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
688 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
690 int szArr,sw,iTypppArr;
691 std::vector<int> stdvecTyyppArr;
693 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
694 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
695 if(sw==3)//DataArrayInt
697 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
698 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
699 std::string name=argpt->getName();
701 ret->setName(name.c_str());
704 PyObject *res = PyList_New(2);
705 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
706 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
707 PyList_SetItem(res,0,obj0);
708 PyList_SetItem(res,1,obj1);
712 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
716 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
717 PyObject *res = PyTuple_New(2);
718 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
721 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
723 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
724 PyTuple_SetItem(res,0,obj0);
725 PyTuple_SetItem(res,1,obj1);
729 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
731 std::vector<int> vals=self->getDistributionOfTypes();
733 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
734 PyObject *ret=PyList_New((int)vals.size()/3);
735 for(int j=0;j<(int)vals.size()/3;j++)
737 PyObject *ret1=PyList_New(3);
738 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
739 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
740 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
741 PyList_SetItem(ret,j,ret1);
746 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
748 std::vector<int> code;
749 std::vector<const DataArrayInt *> idsPerType;
750 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
751 convertPyToNewIntArr4(li,1,3,code);
752 return self->checkTypeConsistencyAndContig(code,idsPerType);
755 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
757 std::vector<int> code;
758 std::vector<DataArrayInt *> idsInPflPerType;
759 std::vector<DataArrayInt *> idsPerType;
760 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
761 PyObject *ret=PyTuple_New(3);
764 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
765 PyObject *ret0=PyList_New((int)code.size()/3);
766 for(int j=0;j<(int)code.size()/3;j++)
768 PyObject *ret00=PyList_New(3);
769 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
770 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
771 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
772 PyList_SetItem(ret0,j,ret00);
774 PyTuple_SetItem(ret,0,ret0);
776 PyObject *ret1=PyList_New(idsInPflPerType.size());
777 for(std::size_t j=0;j<idsInPflPerType.size();j++)
778 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
779 PyTuple_SetItem(ret,1,ret1);
780 int n=idsPerType.size();
781 PyObject *ret2=PyList_New(n);
783 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
784 PyTuple_SetItem(ret,2,ret2);
788 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
792 DataArrayDoubleTuple *aa;
793 std::vector<double> bb;
795 int spaceDim=self->getSpaceDimension();
796 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
797 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
798 self->translate(vectorPtr);
801 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
803 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
806 DataArrayDoubleTuple *aa;
807 std::vector<double> bb;
809 int spaceDim=self->getSpaceDimension();
810 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
811 self->rotate(centerPtr,0,alpha);
814 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
816 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
818 DataArrayDouble *a,*a2;
819 DataArrayDoubleTuple *aa,*aa2;
820 std::vector<double> bb,bb2;
822 int spaceDim=self->getSpaceDimension();
823 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
824 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
825 self->rotate(centerPtr,vectorPtr,alpha);
828 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
830 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
831 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
832 PyObject *res=PyList_New(result.size());
833 for(int i=0;iL!=result.end(); i++, iL++)
834 PyList_SetItem(res,i,PyInt_FromLong(*iL));
838 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
840 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
841 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
842 return MEDCouplingMesh::MergeMeshes(tmp);
848 //== MEDCouplingMesh End
850 %include "NormalizedGeometricTypes"
851 %include "MEDCouplingNatureOfFieldEnum"
855 class MEDCouplingNatureOfField
858 static const char *GetRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception);
859 static std::string GetReprNoThrow(NatureOfField nat);
860 static std::string GetAllPossibilitiesStr();
864 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
865 // include "MEDCouplingTimeDiscretization.i"
869 class MEDCouplingGaussLocalization
872 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
873 const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
874 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
875 INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
876 void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
877 int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
878 int getDimension() const throw(INTERP_KERNEL::Exception);
879 int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
880 std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
881 void checkCoherency() const throw(INTERP_KERNEL::Exception);
882 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception);
884 const std::vector<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
885 double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
886 const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
887 double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
888 const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
889 double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
890 void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
891 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
892 void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
893 void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
894 void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
895 void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
897 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
901 %include "MEDCouplingFieldDiscretization.i"
903 //== MEDCouplingPointSet
907 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
910 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
911 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
912 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
913 void zipCoords() throw(INTERP_KERNEL::Exception);
914 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
915 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
916 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
917 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
918 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
919 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
920 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
921 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
922 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
923 static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception);
924 virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
925 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
926 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
927 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
928 virtual DataArrayInt *findBoundaryNodes() const;
929 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
930 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
931 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
932 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
933 virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
934 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
937 std::string __str__() const throw(INTERP_KERNEL::Exception)
939 return self->simpleRepr();
942 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
945 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
946 PyObject *res = PyList_New(2);
947 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
948 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
952 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
954 DataArrayInt *comm, *commIndex;
955 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
956 PyObject *res = PyList_New(2);
957 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
958 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
962 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
964 DataArrayDouble *ret1=self->getCoords();
967 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
970 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
972 int szArr,sw,iTypppArr;
973 std::vector<int> stdvecTyyppArr;
974 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
975 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
976 if(sw==3)//DataArrayInt
978 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
979 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
980 std::string name=argpt->getName();
982 ret->setName(name.c_str());
984 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
987 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
989 int szArr,sw,iTypppArr;
990 std::vector<int> stdvecTyyppArr;
991 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
992 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
993 if(sw==3)//DataArrayInt
995 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
996 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
997 std::string name=argpt->getName();
999 ret->setName(name.c_str());
1001 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1004 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
1006 int szArr,sw,iTypppArr;
1007 std::vector<int> stdvecTyyppArr;
1008 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1009 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1010 if(sw==3)//DataArrayInt
1012 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1013 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1014 std::string name=argpt->getName();
1016 ret->setName(name.c_str());
1018 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1021 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1023 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1024 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1027 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1029 int szArr,sw,iTypppArr;
1030 std::vector<int> stdvecTyyppArr;
1031 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1032 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1033 if(sw==3)//DataArrayInt
1035 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1036 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1037 std::string name=argpt->getName();
1039 ret->setName(name.c_str());
1041 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1044 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1046 int szArr,sw,iTypppArr;
1047 std::vector<int> stdvecTyyppArr;
1048 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1049 self->renumberNodes(tmp,newNbOfNodes);
1052 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1054 int szArr,sw,iTypppArr;
1055 std::vector<int> stdvecTyyppArr;
1056 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1057 self->renumberNodes2(tmp,newNbOfNodes);
1060 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1062 int spaceDim=self->getSpaceDimension();
1064 DataArrayDouble *a,*a2;
1065 DataArrayDoubleTuple *aa,*aa2;
1066 std::vector<double> bb,bb2;
1068 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1069 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1070 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1071 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1072 std::vector<int> nodes;
1073 self->findNodesOnLine(p,v,eps,nodes);
1074 DataArrayInt *ret=DataArrayInt::New();
1075 ret->alloc((int)nodes.size(),1);
1076 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1077 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1079 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1081 int spaceDim=self->getSpaceDimension();
1083 DataArrayDouble *a,*a2;
1084 DataArrayDoubleTuple *aa,*aa2;
1085 std::vector<double> bb,bb2;
1087 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1088 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1089 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1090 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1091 std::vector<int> nodes;
1092 self->findNodesOnPlane(p,v,eps,nodes);
1093 DataArrayInt *ret=DataArrayInt::New();
1094 ret->alloc((int)nodes.size(),1);
1095 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1096 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1099 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1103 DataArrayDoubleTuple *aa;
1104 std::vector<double> bb;
1106 int spaceDim=self->getSpaceDimension();
1107 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1108 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1109 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1110 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1113 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1115 DataArrayInt *c=0,*cI=0;
1119 DataArrayDoubleTuple *aa;
1120 std::vector<double> bb;
1122 int spaceDim=self->getSpaceDimension();
1123 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1124 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1125 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1126 PyObject *ret=PyTuple_New(2);
1127 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1128 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1132 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1134 DataArrayInt *c=0,*cI=0;
1135 int spaceDim=self->getSpaceDimension();
1138 DataArrayDoubleTuple *aa;
1139 std::vector<double> bb;
1142 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1143 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1145 PyObject *ret=PyTuple_New(2);
1146 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1147 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1151 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1155 DataArrayDoubleTuple *aa;
1156 std::vector<double> bb;
1158 int spaceDim=self->getSpaceDimension();
1159 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1160 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1162 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1163 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1166 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1170 std::vector<int> multiVal;
1171 std::pair<int, std::pair<int,int> > slic;
1172 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1173 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1177 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1179 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1181 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1183 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1187 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1189 DataArrayInt *v0=0,*v1=0;
1190 self->findCommonCells(compType,startCellId,v0,v1);
1191 PyObject *res = PyList_New(2);
1192 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1193 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1198 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1201 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1202 if (!SWIG_IsOK(res1))
1205 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1206 self->renumberNodesInConn(tmp);
1210 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1212 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1213 da2->checkAllocated();
1214 self->renumberNodesInConn(da2->getConstPointer());
1218 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1221 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1222 PyObject *ret=PyTuple_New(2);
1223 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1224 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1228 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1230 DataArrayInt *ret=0;
1232 int szArr,sw,iTypppArr;
1233 std::vector<int> stdvecTyyppArr;
1234 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1235 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1239 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1243 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1244 PyObject *res = PyList_New(3);
1245 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1246 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1247 PyList_SetItem(res,2,SWIG_From_int(ret2));
1251 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1255 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1256 PyObject *res = PyList_New(3);
1257 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1258 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1259 PyList_SetItem(res,2,SWIG_From_int(ret2));
1263 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1266 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1267 if (!SWIG_IsOK(res1))
1270 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1271 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1275 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1277 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1278 da2->checkAllocated();
1279 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1283 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1287 std::vector<int> multiVal;
1288 std::pair<int, std::pair<int,int> > slic;
1289 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1290 int nbc=self->getNumberOfCells();
1291 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1298 std::ostringstream oss;
1299 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1300 throw INTERP_KERNEL::Exception(oss.str().c_str());
1303 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1308 int tmp=nbc+singleVal;
1309 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1313 std::ostringstream oss;
1314 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1315 throw INTERP_KERNEL::Exception(oss.str().c_str());
1321 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1325 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1330 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1331 daIntTyypp->checkAllocated();
1332 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1335 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1339 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1342 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1343 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1344 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1345 for(int i=0;i<sz;i++)
1346 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1349 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1352 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1354 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1355 std::vector<double> val3;
1356 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1357 "Rotate2DAlg",2,true,nbNodes);
1359 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1360 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1363 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1366 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1367 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1368 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1369 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1370 for(int i=0;i<sz;i++)
1371 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1374 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1377 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1379 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1380 std::vector<double> val3;
1381 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1382 "Rotate3DAlg",3,true,nbNodes);
1384 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1385 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1386 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1391 //== MEDCouplingPointSet End
1393 class MEDCouplingUMeshCell
1396 INTERP_KERNEL::NormalizedCellType getType() const;
1399 std::string __str__() const throw(INTERP_KERNEL::Exception)
1401 return self->repr();
1404 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1407 const int *r=self->getAllConn(ret2);
1408 PyObject *ret=PyTuple_New(ret2);
1409 for(int i=0;i<ret2;i++)
1410 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1416 class MEDCouplingUMeshCellIterator
1423 MEDCouplingUMeshCell *ret=self->nextt();
1425 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1428 PyErr_SetString(PyExc_StopIteration,"No more data.");
1435 class MEDCouplingUMeshCellByTypeIterator
1438 ~MEDCouplingUMeshCellByTypeIterator();
1443 MEDCouplingUMeshCellEntry *ret=self->nextt();
1445 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1448 PyErr_SetString(PyExc_StopIteration,"No more data.");
1455 class MEDCouplingUMeshCellByTypeEntry
1458 ~MEDCouplingUMeshCellByTypeEntry();
1461 MEDCouplingUMeshCellByTypeIterator *__iter__()
1463 return self->iterator();
1468 class MEDCouplingUMeshCellEntry
1471 INTERP_KERNEL::NormalizedCellType getType() const;
1472 int getNumberOfElems() const;
1475 MEDCouplingUMeshCellIterator *__iter__()
1477 return self->iterator();
1482 //== MEDCouplingUMesh
1484 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1487 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1488 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1489 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1490 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1491 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1492 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1493 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1494 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1495 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1496 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1497 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1498 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1499 void computeTypes() throw(INTERP_KERNEL::Exception);
1500 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1501 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1503 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1504 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1505 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1506 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1507 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1508 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1509 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1510 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1511 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1512 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1513 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1514 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1515 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1516 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1517 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1518 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1519 bool isFullyQuadratic() const throw(INTERP_KERNEL::Exception);
1520 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1521 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1522 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1523 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1524 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1525 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1526 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1527 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1528 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1529 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1530 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1531 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1532 DataArrayDouble *computePlaneEquationOf3DFaces() const throw(INTERP_KERNEL::Exception);
1533 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1534 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1535 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1536 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1537 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1538 DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1539 DataArrayInt *buildUnionOf2DMesh() const throw(INTERP_KERNEL::Exception);
1540 DataArrayInt *buildUnionOf3DMesh() const throw(INTERP_KERNEL::Exception);
1541 DataArrayDouble *getBoundingBoxForBBTreeFast() const throw(INTERP_KERNEL::Exception);
1542 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1543 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1544 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1545 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1546 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1547 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1549 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1551 return MEDCouplingUMesh::New();
1554 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1556 return MEDCouplingUMesh::New(meshName,meshDim);
1559 std::string __str__() const throw(INTERP_KERNEL::Exception)
1561 return self->simpleRepr();
1564 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1566 std::ostringstream oss;
1567 self->reprQuickOverview(oss);
1571 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1573 return self->cellIterator();
1576 PyObject *getAllGeoTypesSorted() const throw(INTERP_KERNEL::Exception)
1578 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
1579 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1580 PyObject *res=PyList_New(result.size());
1581 for(int i=0;iL!=result.end(); i++, iL++)
1582 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1586 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1590 std::vector<int> multiVal;
1591 std::pair<int, std::pair<int,int> > slic;
1592 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1593 int nbc=self->getNumberOfCells();
1594 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1601 std::ostringstream oss;
1602 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1603 throw INTERP_KERNEL::Exception(oss.str().c_str());
1607 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1614 int tmp=nbc+singleVal;
1615 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1620 std::ostringstream oss;
1621 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1622 throw INTERP_KERNEL::Exception(oss.str().c_str());
1628 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1634 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1635 daIntTyypp->checkAllocated();
1636 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1640 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1644 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1648 std::vector<int> multiVal;
1649 std::pair<int, std::pair<int,int> > slic;
1650 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1651 int nbc=self->getNumberOfCells();
1652 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1659 std::ostringstream oss;
1660 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1661 throw INTERP_KERNEL::Exception(oss.str().c_str());
1665 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1672 int tmp=nbc+singleVal;
1673 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1678 std::ostringstream oss;
1679 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1680 throw INTERP_KERNEL::Exception(oss.str().c_str());
1686 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1691 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1697 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1698 daIntTyypp->checkAllocated();
1699 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1703 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1707 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1709 int szArr,sw,iTypppArr;
1710 std::vector<int> stdvecTyyppArr;
1711 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1714 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1715 throw INTERP_KERNEL::Exception(oss.str().c_str());
1717 self->insertNextCell(type,size,tmp);
1720 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1722 int szArr,sw,iTypppArr;
1723 std::vector<int> stdvecTyyppArr;
1724 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1725 self->insertNextCell(type,szArr,tmp);
1728 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1730 DataArrayInt *ret=self->getNodalConnectivity();
1735 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1737 DataArrayInt *ret=self->getNodalConnectivityIndex();
1743 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1745 int szArr,sw,iTypppArr;
1746 std::vector<int> stdvecTyyppArr;
1747 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1748 int nbOfDepthPeelingPerformed=0;
1749 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1750 PyObject *res=PyTuple_New(2);
1751 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1752 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1756 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1758 DataArrayInt *v0=0,*v1=0;
1759 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1760 PyObject *res = PyList_New(2);
1761 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1762 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1766 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1770 DataArrayDoubleTuple *aa;
1771 std::vector<double> bb;
1773 int nbOfCompo=self->getSpaceDimension();
1774 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1777 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1778 PyObject *ret=PyTuple_New(2);
1779 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1780 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1784 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1786 DataArrayInt *ret1=0;
1787 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1788 PyObject *ret=PyTuple_New(2);
1789 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1790 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1794 PyObject *tetrahedrize(int policy) throw(INTERP_KERNEL::Exception)
1797 DataArrayInt *ret1(0);
1798 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
1799 PyObject *ret=PyTuple_New(3);
1800 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
1801 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1802 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
1806 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1808 std::vector<int> cells;
1809 self->checkButterflyCells(cells,eps);
1810 DataArrayInt *ret=DataArrayInt::New();
1811 ret->alloc((int)cells.size(),1);
1812 std::copy(cells.begin(),cells.end(),ret->getPointer());
1813 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1816 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1818 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1820 PyObject *ret = PyList_New(sz);
1821 for(int i=0;i<sz;i++)
1822 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1826 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1828 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1829 int sz=retCpp.size();
1830 PyObject *ret=PyList_New(sz);
1831 for(int i=0;i<sz;i++)
1832 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1836 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1839 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1840 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1841 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1844 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1847 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1848 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1852 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1855 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1856 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1860 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1862 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1863 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1864 PyObject *ret=PyTuple_New(3);
1865 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1866 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1867 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1871 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1873 DataArrayInt *tmp0=0,*tmp1=0;
1874 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1875 PyObject *ret=PyTuple_New(2);
1876 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1877 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1881 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1885 std::vector<int> multiVal;
1886 std::pair<int, std::pair<int,int> > slic;
1887 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1888 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1892 return self->duplicateNodes(&singleVal,&singleVal+1);
1894 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
1896 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
1898 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1902 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
1906 std::vector<int> multiVal;
1907 std::pair<int, std::pair<int,int> > slic;
1908 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1909 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1913 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
1915 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
1917 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
1919 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1923 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
1926 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1927 DataArrayInt *tmp0,*tmp1=0;
1928 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
1929 PyObject *ret=PyTuple_New(2);
1930 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1931 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1935 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const throw(INTERP_KERNEL::Exception)
1937 DataArrayInt *ret0=0,*ret1=0;
1938 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
1939 PyObject *ret=PyTuple_New(2);
1940 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1941 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1945 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1947 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1948 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1949 DataArrayInt *ret1=0,*ret2=0;
1950 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
1951 PyObject *ret=PyTuple_New(3);
1952 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1953 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1954 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1958 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1960 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1961 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1962 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
1963 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1966 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
1969 std::vector<const MEDCouplingUMesh *> meshes;
1970 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1971 std::vector<DataArrayInt *> corr;
1972 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
1974 PyObject *ret1=PyList_New(sz);
1975 for(int i=0;i<sz;i++)
1976 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1977 PyObject *ret=PyList_New(2);
1978 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1979 PyList_SetItem(ret,1,ret1);
1983 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1985 std::vector<MEDCouplingUMesh *> meshes;
1986 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1987 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
1990 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
1992 std::vector<MEDCouplingUMesh *> meshes;
1993 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1994 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
1997 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
2001 std::vector<int> multiVal;
2002 std::pair<int, std::pair<int,int> > slic;
2003 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2005 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2006 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2010 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2012 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2014 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2016 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2020 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2022 DataArrayInt *arrOut=0,*arrIndexOut=0;
2025 std::vector<int> multiVal;
2026 std::pair<int, std::pair<int,int> > slic;
2027 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2029 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2030 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2035 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2040 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2045 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2049 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2051 PyObject *ret=PyTuple_New(2);
2052 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2053 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2057 static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2059 DataArrayInt *arrOut=0,*arrIndexOut=0;
2060 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2061 PyObject *ret=PyTuple_New(2);
2062 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2063 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2067 static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2069 if(!PySlice_Check(slic))
2070 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !");
2071 Py_ssize_t strt=2,stp=2,step=2;
2072 PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
2074 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !");
2075 arrIndxIn->checkAllocated();
2076 if(arrIndxIn->getNumberOfComponents()!=1)
2077 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !");
2078 if(PySlice_GetIndices(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step)!=0)
2079 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !");
2080 DataArrayInt *arrOut=0,*arrIndexOut=0;
2081 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2082 PyObject *ret=PyTuple_New(2);
2083 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2084 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2088 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2089 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2090 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2092 DataArrayInt *arrOut=0,*arrIndexOut=0;
2095 std::vector<int> multiVal;
2096 std::pair<int, std::pair<int,int> > slic;
2097 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2099 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2100 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2105 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2110 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2115 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2119 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2121 PyObject *ret=PyTuple_New(2);
2122 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2123 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2127 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2128 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2132 std::vector<int> multiVal;
2133 std::pair<int, std::pair<int,int> > slic;
2134 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2136 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2137 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2142 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2147 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2152 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2156 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2160 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2164 DataArrayDoubleTuple *aa;
2165 std::vector<double> bb;
2167 int spaceDim=self->getSpaceDimension();
2168 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2169 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2171 std::vector<int> cells;
2172 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2173 DataArrayInt *ret=DataArrayInt::New();
2174 ret->alloc((int)cells.size(),1);
2175 std::copy(cells.begin(),cells.end(),ret->getPointer());
2176 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2179 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2183 DataArrayDoubleTuple *aa;
2184 std::vector<double> bb;
2186 int spaceDim=self->getSpaceDimension();
2187 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2188 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2189 self->orientCorrectly2DCells(v,polyOnly);
2192 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2194 std::vector<int> cells;
2195 self->arePolyhedronsNotCorrectlyOriented(cells);
2196 DataArrayInt *ret=DataArrayInt::New();
2197 ret->alloc((int)cells.size(),1);
2198 std::copy(cells.begin(),cells.end(),ret->getPointer());
2199 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2202 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2206 self->getFastAveragePlaneOfThis(vec,pos);
2208 std::copy(vec,vec+3,vals);
2209 std::copy(pos,pos+3,vals+3);
2210 return convertDblArrToPyListOfTuple(vals,3,2);
2213 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2215 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2216 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2217 return MEDCouplingUMesh::MergeUMeshes(tmp);
2220 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2223 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2224 PyObject *ret=PyTuple_New(2);
2225 PyObject *ret0Py=ret0?Py_True:Py_False;
2227 PyTuple_SetItem(ret,0,ret0Py);
2228 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2232 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2235 bool ret0=self->areCellsIncludedIn2(other,ret1);
2236 PyObject *ret=PyTuple_New(2);
2237 PyObject *ret0Py=ret0?Py_True:Py_False;
2239 PyTuple_SetItem(ret,0,ret0Py);
2240 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2244 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2246 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2247 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2248 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2249 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2250 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2251 PyObject *ret=PyTuple_New(5);
2252 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2253 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2254 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2255 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2256 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2260 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2262 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2263 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2264 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2265 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2266 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2267 PyObject *ret=PyTuple_New(5);
2268 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2269 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2270 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2271 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2272 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2276 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2278 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2279 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2280 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2281 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2282 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2283 PyObject *ret=PyTuple_New(5);
2284 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2285 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2286 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2287 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2288 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2292 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2294 DataArrayInt *neighbors=0,*neighborsIdx=0;
2295 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2296 PyObject *ret=PyTuple_New(2);
2297 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2298 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2302 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2304 DataArrayInt *neighbors=0,*neighborsIdx=0;
2305 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2306 PyObject *ret=PyTuple_New(2);
2307 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2308 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2312 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2314 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2315 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2316 DataArrayInt *d2,*d3,*d4,*dd5;
2317 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2318 PyObject *ret=PyTuple_New(7);
2319 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2320 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2321 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2322 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2323 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2324 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2325 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2329 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2332 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2333 da->checkAllocated();
2334 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2337 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2340 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2341 da->checkAllocated();
2342 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2345 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2348 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2349 da->checkAllocated();
2350 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2353 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2356 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2357 da->checkAllocated();
2358 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2359 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2360 PyObject *res = PyList_New(result.size());
2361 for (int i=0;iL!=result.end(); i++, iL++)
2362 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2366 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2369 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2370 da->checkAllocated();
2371 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2372 ret->setName(da->getName().c_str());
2376 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2378 DataArrayInt *cellNb1=0,*cellNb2=0;
2379 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2380 PyObject *ret=PyTuple_New(3);
2381 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2382 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2383 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2387 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2389 int spaceDim=self->getSpaceDimension();
2391 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2393 DataArrayDouble *a,*a2;
2394 DataArrayDoubleTuple *aa,*aa2;
2395 std::vector<double> bb,bb2;
2397 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2398 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2399 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2400 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2402 DataArrayInt *cellIds=0;
2403 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2404 PyObject *ret=PyTuple_New(2);
2405 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2406 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2410 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2412 int spaceDim=self->getSpaceDimension();
2414 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2416 DataArrayDouble *a,*a2;
2417 DataArrayDoubleTuple *aa,*aa2;
2418 std::vector<double> bb,bb2;
2420 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2421 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2422 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2423 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2425 DataArrayInt *cellIds=0;
2426 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2427 PyObject *ret=PyTuple_New(2);
2428 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2429 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2433 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2435 int spaceDim=self->getSpaceDimension();
2437 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2439 DataArrayDouble *a,*a2;
2440 DataArrayDoubleTuple *aa,*aa2;
2441 std::vector<double> bb,bb2;
2443 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2444 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2445 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2446 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2447 return self->getCellIdsCrossingPlane(orig,vect,eps);
2450 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2454 std::vector<int> pos2;
2455 DataArrayInt *pos3=0;
2456 DataArrayIntTuple *pos4=0;
2457 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2462 self->convertToPolyTypes(&pos1,&pos1+1);
2469 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2474 self->convertToPolyTypes(pos3->begin(),pos3->end());
2478 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2482 void convertAllToPoly();
2483 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2484 bool unPolyze() throw(INTERP_KERNEL::Exception);
2485 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2486 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2487 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2490 //== MEDCouplingUMesh End
2492 //== MEDCouplingExtrudedMesh
2494 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2497 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2498 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2500 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2502 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2505 std::string __str__() const throw(INTERP_KERNEL::Exception)
2507 return self->simpleRepr();
2510 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2512 std::ostringstream oss;
2513 self->reprQuickOverview(oss);
2517 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2519 MEDCouplingUMesh *ret=self->getMesh2D();
2522 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2524 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2526 MEDCouplingUMesh *ret=self->getMesh1D();
2529 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2531 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2533 DataArrayInt *ret=self->getMesh3DIds();
2536 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2541 //== MEDCouplingExtrudedMesh End
2543 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2546 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2547 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2548 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2549 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2550 virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2551 virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
2554 virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2556 int szArr,sw,iTypppArr;
2557 std::vector<int> stdvecTyyppArr;
2558 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2559 self->insertNextCell(tmp,tmp+szArr);
2562 virtual DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2564 DataArrayInt *ret=self->getNodalConnectivity();
2565 if(ret) ret->incrRef();
2569 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2571 std::vector< const MEDCoupling1GTUMesh *> parts;
2572 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
2573 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
2578 //== MEDCoupling1SGTUMesh
2580 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2583 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2584 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2585 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2586 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2587 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2588 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2589 MEDCoupling1GTUMesh *computeDualMesh() const throw(INTERP_KERNEL::Exception);
2590 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const throw(INTERP_KERNEL::Exception);
2591 DataArrayInt *sortHexa8EachOther() throw(INTERP_KERNEL::Exception);
2594 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2596 return MEDCoupling1SGTUMesh::New(name,type);
2599 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2601 return MEDCoupling1SGTUMesh::New(m);
2604 std::string __str__() const throw(INTERP_KERNEL::Exception)
2606 return self->simpleRepr();
2609 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2611 std::ostringstream oss;
2612 self->reprQuickOverview(oss);
2616 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2618 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2619 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2620 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2623 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2625 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2626 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2627 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2632 //== MEDCoupling1SGTUMesh End
2634 //== MEDCoupling1DGTUMesh
2636 class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2639 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2640 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2641 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
2642 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2643 bool isPacked() const throw(INTERP_KERNEL::Exception);
2646 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2648 return MEDCoupling1DGTUMesh::New(name,type);
2651 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2653 return MEDCoupling1DGTUMesh::New(m);
2656 std::string __str__() const throw(INTERP_KERNEL::Exception)
2658 return self->simpleRepr();
2661 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2663 std::ostringstream oss;
2664 self->reprQuickOverview(oss);
2668 DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
2670 DataArrayInt *ret=self->getNodalConnectivityIndex();
2671 if(ret) ret->incrRef();
2675 PyObject *retrievePackedNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2677 DataArrayInt *ret1=0,*ret2=0;
2678 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
2679 PyObject *ret0Py=ret0?Py_True:Py_False;
2681 PyObject *ret=PyTuple_New(3);
2682 PyTuple_SetItem(ret,0,ret0Py);
2683 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2684 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2688 PyObject *copyWithNodalConnectivityPacked() const throw(INTERP_KERNEL::Exception)
2691 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
2692 PyObject *ret=PyTuple_New(2);
2693 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
2694 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
2695 PyTuple_SetItem(ret,1,ret1Py);
2699 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2701 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2702 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2703 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
2706 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2708 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2709 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2710 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
2713 static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt) throw(INTERP_KERNEL::Exception)
2715 std::vector<const ParaMEDMEM::DataArrayInt *> tmp;
2716 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2717 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
2722 //== MEDCoupling1DGTUMeshEnd
2724 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2727 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2728 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2729 virtual std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2730 std::vector<int> getCellGridStructure() const throw(INTERP_KERNEL::Exception);
2731 MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception);
2732 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
2735 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const throw(INTERP_KERNEL::Exception)
2737 int tmpp1=-1,tmpp2=-1;
2738 std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
2739 std::vector< std::pair<int,int> > inp;
2743 for(int i=0;i<tmpp1;i++)
2744 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2749 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
2750 inp.resize(tmpp1/2);
2751 for(int i=0;i<tmpp1/2;i++)
2752 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2755 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
2756 return self->buildStructuredSubPart(inp);
2759 static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) throw(INTERP_KERNEL::Exception)
2761 int tmpp1=-1,tmpp2=-1;
2762 std::vector<int> tmp=fillArrayWithPyListInt2(part,tmpp1,tmpp2);
2763 std::vector< std::pair<int,int> > inp;
2767 for(int i=0;i<tmpp1;i++)
2768 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2773 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.BuildExplicitIdsFrom : invalid input size ! Must be even size !");
2774 inp.resize(tmpp1/2);
2775 for(int i=0;i<tmpp1/2;i++)
2776 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2779 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.BuildExplicitIdsFrom : invalid input size !");
2781 int szArr,sw,iTypppArr;
2782 std::vector<int> stdvecTyyppArr;
2783 const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
2784 std::vector<int> tmp5(tmp4,tmp4+szArr);
2786 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
2789 static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) throw(INTERP_KERNEL::Exception)
2791 int szArr,sw,iTypppArr;
2792 std::vector<int> stdvecTyyppArr;
2793 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2794 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
2797 static PyObject *IsPartStructured(PyObject *li, PyObject *st) throw(INTERP_KERNEL::Exception)
2799 int szArr,sw,iTypppArr;
2800 std::vector<int> stdvecTyyppArr;
2801 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2802 int szArr2,sw2,iTypppArr2;
2803 std::vector<int> stdvecTyyppArr2;
2804 const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
2805 std::vector<int> tmp3(tmp2,tmp2+szArr2);
2806 std::vector< std::pair<int,int> > partCompactFormat;
2807 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
2808 PyObject *ret=PyTuple_New(2);
2809 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
2810 PyTuple_SetItem(ret,0,ret0Py);
2811 PyObject *ret1Py=PyList_New(partCompactFormat.size());
2812 for(std::size_t i=0;i<partCompactFormat.size();i++)
2814 PyObject *tmp4=PyTuple_New(2);
2815 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
2816 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
2817 PyList_SetItem(ret1Py,i,tmp4);
2819 PyTuple_SetItem(ret,1,ret1Py);
2825 //== MEDCouplingCMesh
2827 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2830 static MEDCouplingCMesh *New();
2831 static MEDCouplingCMesh *New(const std::string& meshName);
2832 MEDCouplingCMesh *clone(bool recDeepCpy) const;
2833 void setCoords(const DataArrayDouble *coordsX,
2834 const DataArrayDouble *coordsY=0,
2835 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
2836 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
2840 return MEDCouplingCMesh::New();
2842 MEDCouplingCMesh(const std::string& meshName)
2844 return MEDCouplingCMesh::New(meshName);
2846 std::string __str__() const throw(INTERP_KERNEL::Exception)
2848 return self->simpleRepr();
2850 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2852 std::ostringstream oss;
2853 self->reprQuickOverview(oss);
2856 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
2858 DataArrayDouble *ret=self->getCoordsAt(i);
2866 //== MEDCouplingCMesh End
2868 //== MEDCouplingCurveLinearMesh
2870 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2873 static MEDCouplingCurveLinearMesh *New();
2874 static MEDCouplingCurveLinearMesh *New(const std::string& meshName);
2875 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
2876 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
2878 MEDCouplingCurveLinearMesh()
2880 return MEDCouplingCurveLinearMesh::New();
2882 MEDCouplingCurveLinearMesh(const std::string& meshName)
2884 return MEDCouplingCurveLinearMesh::New(meshName);
2886 std::string __str__() const throw(INTERP_KERNEL::Exception)
2888 return self->simpleRepr();
2890 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2892 std::ostringstream oss;
2893 self->reprQuickOverview(oss);
2896 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
2898 DataArrayDouble *ret=self->getCoords();
2903 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
2905 int szArr,sw,iTypppArr;
2906 std::vector<int> stdvecTyyppArr;
2907 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
2908 self->setNodeGridStructure(tmp,tmp+szArr);
2913 //== MEDCouplingCurveLinearMesh End
2916 namespace ParaMEDMEM
2918 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
2921 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
2922 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
2923 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2924 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2925 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
2926 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
2927 void setName(const char *name) throw(INTERP_KERNEL::Exception);
2928 std::string getDescription() const throw(INTERP_KERNEL::Exception);
2929 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
2930 std::string getName() const throw(INTERP_KERNEL::Exception);
2931 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
2932 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
2933 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
2934 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
2935 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
2936 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
2937 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
2938 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
2939 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
2940 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
2941 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
2942 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
2943 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
2944 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
2945 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
2946 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
2948 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
2950 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
2953 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
2956 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
2958 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
2961 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
2964 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
2966 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
2967 return convertIntArrToPyList3(ret);
2970 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
2973 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
2974 PyObject *ret=PyTuple_New(2);
2975 PyObject *ret0Py=ret0?Py_True:Py_False;
2977 PyTuple_SetItem(ret,0,ret0Py);
2978 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2982 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
2984 DataArrayInt *ret1=0;
2985 MEDCouplingMesh *ret0=0;
2987 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2988 if (!SWIG_IsOK(res1))
2991 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2992 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
2996 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2998 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2999 da2->checkAllocated();
3000 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3002 PyObject *res = PyList_New(2);
3003 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3004 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3008 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
3010 DataArrayInt *ret1=0;
3012 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3013 PyObject *res=PyTuple_New(2);
3014 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3016 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3019 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3020 PyTuple_SetItem(res,1,res1);
3025 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3028 int v0; std::vector<int> v1;
3029 const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
3030 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3033 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3034 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3037 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3038 if (!SWIG_IsOK(res1))
3041 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3042 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3046 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3048 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3049 da2->checkAllocated();
3050 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3054 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3056 std::vector<int> tmp;
3057 self->getCellIdsHavingGaussLocalization(locId,tmp);
3058 DataArrayInt *ret=DataArrayInt::New();
3059 ret->alloc((int)tmp.size(),1);
3060 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3061 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3064 int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
3066 std::vector<int> inp0;
3067 convertPyToNewIntArr4(code,1,3,inp0);
3068 std::vector<const DataArrayInt *> inp1;
3069 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(idsPerType,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",inp1);
3070 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3075 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3078 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3079 static MEDCouplingFieldTemplate *New(TypeOfField type);
3080 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3081 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3084 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3086 return MEDCouplingFieldTemplate::New(f);
3089 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3091 return MEDCouplingFieldTemplate::New(type);
3094 std::string __str__() const throw(INTERP_KERNEL::Exception)
3096 return self->simpleRepr();
3099 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3101 std::ostringstream oss;
3102 self->reprQuickOverview(oss);
3108 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3111 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3112 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3113 void setTimeUnit(const std::string& unit);
3114 std::string getTimeUnit() const;
3115 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3116 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3117 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3118 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3119 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3120 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
3121 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3122 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3123 MEDCouplingFieldDouble *deepCpy() const;
3124 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3125 MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
3126 MEDCouplingFieldDouble *cellToNodeDiscretization() const throw(INTERP_KERNEL::Exception);
3127 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3128 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3129 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3130 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3131 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3132 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3133 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3134 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3135 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3136 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3137 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3138 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3139 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3140 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3141 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3142 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3143 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3144 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3145 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3146 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3147 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3148 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3149 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3150 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3151 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3152 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3153 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3154 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3155 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3156 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3157 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3158 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3159 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3160 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3161 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3162 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3163 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3164 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3165 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3166 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3167 void fillFromAnalytic(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3168 void fillFromAnalytic2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3169 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3170 void applyFunc(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3171 void applyFunc2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3172 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3173 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3174 void applyFunc(const std::string& func) throw(INTERP_KERNEL::Exception);
3175 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
3176 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
3177 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3178 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3179 double getMinValue() const throw(INTERP_KERNEL::Exception);
3180 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3181 double norm2() const throw(INTERP_KERNEL::Exception);
3182 double normMax() const throw(INTERP_KERNEL::Exception);
3183 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3184 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3185 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3186 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3187 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3188 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3189 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3190 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3191 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3192 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3193 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3194 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3195 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3196 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3197 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3198 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3199 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3200 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3201 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3202 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3203 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3204 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3206 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3208 return MEDCouplingFieldDouble::New(type,td);
3211 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3213 return MEDCouplingFieldDouble::New(ft,td);
3216 std::string __str__() const throw(INTERP_KERNEL::Exception)
3218 return self->simpleRepr();
3221 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3223 std::ostringstream oss;
3224 self->reprQuickOverview(oss);
3228 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3230 DataArrayDouble *ret=self->getArray();
3236 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3238 std::vector<DataArrayDouble *> arrs=self->getArrays();
3239 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3243 PyObject *ret=PyTuple_New(sz);
3244 for(int i=0;i<sz;i++)
3247 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3249 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3254 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3256 std::vector<const DataArrayDouble *> tmp;
3257 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3259 std::vector<DataArrayDouble *> arrs(sz);
3260 for(int i=0;i<sz;i++)
3261 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3262 self->setArrays(arrs);
3265 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3267 DataArrayDouble *ret=self->getEndArray();
3273 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3277 DataArrayDoubleTuple *aa;
3278 std::vector<double> bb;
3280 const MEDCouplingMesh *mesh=self->getMesh();
3282 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3283 int spaceDim=mesh->getSpaceDimension();
3284 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3285 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3287 int sz=self->getNumberOfComponents();
3288 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3289 self->getValueOn(spaceLoc,res);
3290 return convertDblArrToPyList(res,sz);
3293 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3295 int sz=self->getNumberOfComponents();
3296 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3297 self->getValueOnPos(i,j,k,res);
3298 return convertDblArrToPyList(res,sz);
3301 DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
3303 const MEDCouplingMesh *mesh(self->getMesh());
3305 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3308 double v0; ParaMEDMEM::DataArrayDouble *v1(0); ParaMEDMEM::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
3309 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
3310 mesh->getSpaceDimension(),true,nbPts);
3311 return self->getValueOnMulti(inp,nbPts);
3314 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3318 DataArrayDoubleTuple *aa;
3319 std::vector<double> bb;
3321 const MEDCouplingMesh *mesh=self->getMesh();
3323 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3324 int spaceDim=mesh->getSpaceDimension();
3325 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3326 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3329 int sz=self->getNumberOfComponents();
3330 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3331 self->getValueOn(spaceLoc,time,res);
3332 return convertDblArrToPyList(res,sz);
3335 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3337 if(self->getArray()!=0)
3338 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3341 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3342 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3343 self->setArray(arr);
3347 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3350 double tmp0=self->getTime(tmp1,tmp2);
3351 PyObject *res = PyList_New(3);
3352 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3353 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3354 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3358 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3361 double tmp0=self->getStartTime(tmp1,tmp2);
3362 PyObject *res = PyList_New(3);
3363 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3364 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3365 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3369 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3372 double tmp0=self->getEndTime(tmp1,tmp2);
3373 PyObject *res = PyList_New(3);
3374 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3375 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3376 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3379 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3381 int sz=self->getNumberOfComponents();
3382 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3383 self->accumulate(tmp);
3384 return convertDblArrToPyList(tmp,sz);
3386 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3388 int sz=self->getNumberOfComponents();
3389 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3390 self->integral(isWAbs,tmp);
3391 return convertDblArrToPyList(tmp,sz);
3393 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3395 int sz=self->getNumberOfComponents();
3396 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3397 self->getWeightedAverageValue(tmp,isWAbs);
3398 return convertDblArrToPyList(tmp,sz);
3400 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3402 int sz=self->getNumberOfComponents();
3403 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3405 return convertDblArrToPyList(tmp,sz);
3407 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3409 int sz=self->getNumberOfComponents();
3410 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3412 return convertDblArrToPyList(tmp,sz);
3414 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3416 int szArr,sw,iTypppArr;
3417 std::vector<int> stdvecTyyppArr;
3418 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3419 self->renumberCells(tmp,check);
3422 void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3424 int szArr,sw,iTypppArr;
3425 std::vector<int> stdvecTyyppArr;
3426 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3427 self->renumberCellsWithoutMesh(tmp,check);
3430 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3432 int szArr,sw,iTypppArr;
3433 std::vector<int> stdvecTyyppArr;
3434 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3435 self->renumberNodes(tmp,eps);
3438 void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3440 int szArr,sw,iTypppArr;
3441 std::vector<int> stdvecTyyppArr;
3442 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3443 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
3446 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3450 std::vector<int> multiVal;
3451 std::pair<int, std::pair<int,int> > slic;
3452 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3453 const MEDCouplingMesh *mesh=self->getMesh();
3455 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3456 int nbc=mesh->getNumberOfCells();
3457 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3464 std::ostringstream oss;
3465 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3466 throw INTERP_KERNEL::Exception(oss.str().c_str());
3469 return self->buildSubPart(&singleVal,&singleVal+1);
3474 int tmp=nbc+singleVal;
3475 return self->buildSubPart(&tmp,&tmp+1);
3479 std::ostringstream oss;
3480 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3481 throw INTERP_KERNEL::Exception(oss.str().c_str());
3487 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3491 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3496 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3497 daIntTyypp->checkAllocated();
3498 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3501 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3505 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3507 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";
3508 if(PyTuple_Check(li))
3510 Py_ssize_t sz=PyTuple_Size(li);
3512 throw INTERP_KERNEL::Exception(msg);
3513 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3516 std::vector<int> multiVal;
3517 std::pair<int, std::pair<int,int> > slic;
3518 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3519 if(!self->getArray())
3520 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3522 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3523 catch(INTERP_KERNEL::Exception& e)
3524 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3525 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3526 DataArrayDouble *ret0Arr=ret0->getArray();
3528 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3533 std::vector<int> v2(1,singleVal);
3534 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3535 ret0->setArray(aarr);
3540 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3541 ret0->setArray(aarr);
3546 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3547 std::vector<int> v2(nbOfComp);
3548 for(int i=0;i<nbOfComp;i++)
3549 v2[i]=slic.first+i*slic.second.second;
3550 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3551 ret0->setArray(aarr);
3555 throw INTERP_KERNEL::Exception(msg);
3560 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3563 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3566 double r1=self->getMaxValue2(tmp);
3567 PyObject *ret=PyTuple_New(2);
3568 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3569 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3573 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3576 double r1=self->getMinValue2(tmp);
3577 PyObject *ret=PyTuple_New(2);
3578 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3579 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3583 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3585 std::vector<int> tmp;
3586 convertPyToNewIntArr3(li,tmp);
3587 return self->keepSelectedComponents(tmp);
3590 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3592 std::vector<int> tmp;
3593 convertPyToNewIntArr3(li,tmp);
3594 self->setSelectedComponents(f,tmp);
3597 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3600 DataArrayDouble *a,*a2;
3601 DataArrayDoubleTuple *aa,*aa2;
3602 std::vector<double> bb,bb2;
3605 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
3606 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
3607 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3608 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3610 return self->extractSlice3D(orig,vect,eps);
3613 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3615 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
3618 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3620 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
3623 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3625 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.";
3626 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
3629 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3631 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3633 return (*self)-(*other);
3635 throw INTERP_KERNEL::Exception(msg);
3640 DataArrayDoubleTuple *aa;
3641 std::vector<double> bb;
3643 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3648 if(!self->getArray())
3649 throw INTERP_KERNEL::Exception(msg2);
3650 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3651 ret->applyLin(1.,-val);
3652 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3653 ret2->setArray(ret);
3658 if(!self->getArray())
3659 throw INTERP_KERNEL::Exception(msg2);
3660 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
3661 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3662 ret2->setArray(ret);
3667 if(!self->getArray())
3668 throw INTERP_KERNEL::Exception(msg2);
3669 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3670 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3671 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3672 ret2->setArray(ret);
3677 if(!self->getArray())
3678 throw INTERP_KERNEL::Exception(msg2);
3679 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3680 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3681 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3682 ret2->setArray(ret);
3686 { throw INTERP_KERNEL::Exception(msg); }
3690 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3692 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
3695 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3697 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
3700 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3702 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
3705 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3707 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.";
3708 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
3711 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3713 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3715 return (*self)/(*other);
3717 throw INTERP_KERNEL::Exception(msg);
3722 DataArrayDoubleTuple *aa;
3723 std::vector<double> bb;
3725 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3731 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
3732 if(!self->getArray())
3733 throw INTERP_KERNEL::Exception(msg2);
3734 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3735 ret->applyLin(1./val,0);
3736 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3737 ret2->setArray(ret);
3742 if(!self->getArray())
3743 throw INTERP_KERNEL::Exception(msg2);
3744 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
3745 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3746 ret2->setArray(ret);
3751 if(!self->getArray())
3752 throw INTERP_KERNEL::Exception(msg2);
3753 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3754 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3755 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3756 ret2->setArray(ret);
3761 if(!self->getArray())
3762 throw INTERP_KERNEL::Exception(msg2);
3763 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3764 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3765 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3766 ret2->setArray(ret);
3770 { throw INTERP_KERNEL::Exception(msg); }
3774 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3776 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
3779 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3781 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.";
3782 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
3785 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3787 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3789 return (*self)^(*other);
3791 throw INTERP_KERNEL::Exception(msg);
3796 DataArrayDoubleTuple *aa;
3797 std::vector<double> bb;
3799 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3804 if(!self->getArray())
3805 throw INTERP_KERNEL::Exception(msg2);
3806 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3808 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3809 ret2->setArray(ret);
3814 if(!self->getArray())
3815 throw INTERP_KERNEL::Exception(msg2);
3816 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
3817 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3818 ret2->setArray(ret);
3823 if(!self->getArray())
3824 throw INTERP_KERNEL::Exception(msg2);
3825 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3826 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3827 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3828 ret2->setArray(ret);
3833 if(!self->getArray())
3834 throw INTERP_KERNEL::Exception(msg2);
3835 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3836 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3837 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3838 ret2->setArray(ret);
3842 { throw INTERP_KERNEL::Exception(msg); }
3846 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
3848 return self->negate();
3851 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3853 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.";
3854 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
3857 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3859 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3863 Py_XINCREF(trueSelf);
3867 throw INTERP_KERNEL::Exception(msg);
3872 DataArrayDoubleTuple *aa;
3873 std::vector<double> bb;
3875 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3880 if(!self->getArray())
3881 throw INTERP_KERNEL::Exception(msg2);
3882 self->getArray()->applyLin(1.,val);
3883 Py_XINCREF(trueSelf);
3888 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3891 Py_XINCREF(trueSelf);
3896 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3897 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3898 ret2->setArray(aaa);
3900 Py_XINCREF(trueSelf);
3905 if(!self->getArray())
3906 throw INTERP_KERNEL::Exception(msg2);
3907 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3908 self->getArray()->addEqual(aaa);
3909 Py_XINCREF(trueSelf);
3913 { throw INTERP_KERNEL::Exception(msg); }
3917 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3919 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.";
3920 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
3923 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3925 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3929 Py_XINCREF(trueSelf);
3933 throw INTERP_KERNEL::Exception(msg);
3938 DataArrayDoubleTuple *aa;
3939 std::vector<double> bb;
3941 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3946 if(!self->getArray())
3947 throw INTERP_KERNEL::Exception(msg2);
3948 self->getArray()->applyLin(1.,-val);
3949 Py_XINCREF(trueSelf);
3954 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3957 Py_XINCREF(trueSelf);
3962 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3963 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3964 ret2->setArray(aaa);
3966 Py_XINCREF(trueSelf);
3971 if(!self->getArray())
3972 throw INTERP_KERNEL::Exception(msg2);
3973 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3974 self->getArray()->substractEqual(aaa);
3975 Py_XINCREF(trueSelf);
3979 { throw INTERP_KERNEL::Exception(msg); }
3983 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3985 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.";
3986 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
3989 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3991 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3995 Py_XINCREF(trueSelf);
3999 throw INTERP_KERNEL::Exception(msg);
4004 DataArrayDoubleTuple *aa;
4005 std::vector<double> bb;
4007 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4012 if(!self->getArray())
4013 throw INTERP_KERNEL::Exception(msg2);
4014 self->getArray()->applyLin(val,0);
4015 Py_XINCREF(trueSelf);
4020 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4023 Py_XINCREF(trueSelf);
4028 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4029 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4030 ret2->setArray(aaa);
4032 Py_XINCREF(trueSelf);
4037 if(!self->getArray())
4038 throw INTERP_KERNEL::Exception(msg2);
4039 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4040 self->getArray()->multiplyEqual(aaa);
4041 Py_XINCREF(trueSelf);
4045 { throw INTERP_KERNEL::Exception(msg); }
4049 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4051 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.";
4052 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4055 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4057 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4061 Py_XINCREF(trueSelf);
4065 throw INTERP_KERNEL::Exception(msg);
4070 DataArrayDoubleTuple *aa;
4071 std::vector<double> bb;
4073 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4079 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4080 if(!self->getArray())
4081 throw INTERP_KERNEL::Exception(msg2);
4082 self->getArray()->applyLin(1./val,0);
4083 Py_XINCREF(trueSelf);
4088 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4091 Py_XINCREF(trueSelf);
4096 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4097 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4098 ret2->setArray(aaa);
4100 Py_XINCREF(trueSelf);
4105 if(!self->getArray())
4106 throw INTERP_KERNEL::Exception(msg2);
4107 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4108 self->getArray()->divideEqual(aaa);
4109 Py_XINCREF(trueSelf);
4113 { throw INTERP_KERNEL::Exception(msg); }
4117 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4119 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.";
4120 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4123 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4125 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4129 Py_XINCREF(trueSelf);
4133 throw INTERP_KERNEL::Exception(msg);
4138 DataArrayDoubleTuple *aa;
4139 std::vector<double> bb;
4141 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4146 if(!self->getArray())
4147 throw INTERP_KERNEL::Exception(msg2);
4148 self->getArray()->applyPow(val);
4149 Py_XINCREF(trueSelf);
4154 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4157 Py_XINCREF(trueSelf);
4162 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4163 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4164 ret2->setArray(aaa);
4166 Py_XINCREF(trueSelf);
4171 if(!self->getArray())
4172 throw INTERP_KERNEL::Exception(msg2);
4173 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4174 self->getArray()->powEqual(aaa);
4175 Py_XINCREF(trueSelf);
4179 { throw INTERP_KERNEL::Exception(msg); }
4183 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4185 std::vector<const MEDCouplingFieldDouble *> tmp;
4186 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4187 return MEDCouplingFieldDouble::MergeFields(tmp);
4190 static void WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
4192 std::vector<const MEDCouplingFieldDouble *> tmp;
4193 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4194 MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4199 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4202 int getNumberOfFields() const;
4203 MEDCouplingMultiFields *deepCpy() const;
4204 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4205 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4206 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4207 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4208 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4211 std::string __str__() const throw(INTERP_KERNEL::Exception)
4213 return self->simpleRepr();
4215 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4217 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4218 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4220 std::vector<MEDCouplingFieldDouble *> fs(sz);
4221 for(int i=0;i<sz;i++)
4222 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4223 return MEDCouplingMultiFields::New(fs);
4225 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4227 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4228 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4230 std::vector<MEDCouplingFieldDouble *> fs(sz);
4231 for(int i=0;i<sz;i++)
4232 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4233 return MEDCouplingMultiFields::New(fs);
4235 PyObject *getFields() const
4237 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4238 int sz=fields.size();
4239 PyObject *res = PyList_New(sz);
4240 for(int i=0;i<sz;i++)
4244 fields[i]->incrRef();
4245 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4249 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4254 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4256 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4260 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4263 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4265 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4267 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4269 PyObject *res = PyList_New(sz);
4270 for(int i=0;i<sz;i++)
4275 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4279 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4284 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4286 std::vector<int> refs;
4287 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4289 PyObject *res = PyList_New(sz);
4290 for(int i=0;i<sz;i++)
4295 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4299 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4303 PyObject *ret=PyTuple_New(2);
4304 PyTuple_SetItem(ret,0,res);
4305 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4308 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4310 std::vector<DataArrayDouble *> ms=self->getArrays();
4312 PyObject *res = PyList_New(sz);
4313 for(int i=0;i<sz;i++)
4318 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4322 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4327 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4329 std::vector< std::vector<int> > refs;
4330 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4332 PyObject *res = PyList_New(sz);
4333 PyObject *res2 = PyList_New(sz);
4334 for(int i=0;i<sz;i++)
4339 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4343 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4345 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4348 PyObject *ret=PyTuple_New(2);
4349 PyTuple_SetItem(ret,0,res);
4350 PyTuple_SetItem(ret,1,res2);
4356 class MEDCouplingDefinitionTime
4359 MEDCouplingDefinitionTime();
4360 void assign(const MEDCouplingDefinitionTime& other);
4361 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4362 double getTimeResolution() const;
4363 std::vector<double> getHotSpotsTime() const;
4366 std::string __str__() const throw(INTERP_KERNEL::Exception)
4368 std::ostringstream oss;
4369 self->appendRepr(oss);
4373 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4375 int meshId,arrId,arrIdInField,fieldId;
4376 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4377 PyObject *res=PyList_New(4);
4378 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4379 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4380 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4381 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4385 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4387 int meshId,arrId,arrIdInField,fieldId;
4388 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4389 PyObject *res=PyList_New(4);
4390 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4391 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4392 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4393 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4399 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4402 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4403 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4407 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4409 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4410 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4412 std::vector<MEDCouplingFieldDouble *> fs(sz);
4413 for(int i=0;i<sz;i++)
4414 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4415 return MEDCouplingFieldOverTime::New(fs);
4417 std::string __str__() const throw(INTERP_KERNEL::Exception)
4419 return self->simpleRepr();
4421 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4423 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4424 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4426 std::vector<MEDCouplingFieldDouble *> fs(sz);
4427 for(int i=0;i<sz;i++)
4428 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4429 return MEDCouplingFieldOverTime::New(fs);
4437 __filename=os.environ.get('PYTHONSTARTUP')
4438 if __filename and os.path.isfile(__filename):
4439 execfile(__filename)