1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
27 #include "MEDCouplingMemArray.hxx"
28 #include "MEDCouplingUMesh.hxx"
29 #include "MEDCouplingExtrudedMesh.hxx"
30 #include "MEDCouplingCMesh.hxx"
31 #include "MEDCouplingCurveLinearMesh.hxx"
32 #include "MEDCoupling1GTUMesh.hxx"
33 #include "MEDCouplingField.hxx"
34 #include "MEDCouplingFieldDouble.hxx"
35 #include "MEDCouplingFieldTemplate.hxx"
36 #include "MEDCouplingGaussLocalization.hxx"
37 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
38 #include "MEDCouplingMultiFields.hxx"
39 #include "MEDCouplingFieldOverTime.hxx"
40 #include "MEDCouplingDefinitionTime.hxx"
41 #include "MEDCouplingFieldDiscretization.hxx"
42 #include "MEDCouplingTypemaps.i"
44 #include "InterpKernelAutoPtr.hxx"
46 using namespace ParaMEDMEM;
47 using namespace INTERP_KERNEL;
51 %template(ivec) std::vector<int>;
52 %template(dvec) std::vector<double>;
53 %template(svec) std::vector<std::string>;
56 %typemap(out) ParaMEDMEM::MEDCouplingMesh*
58 $result=convertMesh($1,$owner);
61 %typemap(out) MEDCouplingMesh*
63 $result=convertMesh($1,$owner);
68 %typemap(out) ParaMEDMEM::MEDCouplingPointSet*
70 $result=convertMesh($1,$owner);
73 %typemap(out) MEDCouplingPointSet*
75 $result=convertMesh($1,$owner);
81 %typemap(out) ParaMEDMEM::MEDCoupling1GTUMesh*
83 $result=convertMesh($1,$owner);
86 %typemap(out) MEDCoupling1GTUMesh*
88 $result=convertMesh($1,$owner);
93 %typemap(out) ParaMEDMEM::MEDCouplingStructuredMesh*
95 $result=convertMesh($1,$owner);
98 %typemap(out) MEDCouplingStructuredMesh*
100 $result=convertMesh($1,$owner);
105 %typemap(out) ParaMEDMEM::MEDCouplingFieldDiscretization*
107 $result=convertFieldDiscretization($1,$owner);
110 %typemap(out) MEDCouplingFieldDiscretization*
112 $result=convertFieldDiscretization($1,$owner);
117 %typemap(out) ParaMEDMEM::MEDCouplingMultiFields*
119 $result=convertMultiFields($1,$owner);
122 %typemap(out) MEDCouplingMultiFields*
124 $result=convertMultiFields($1,$owner);
129 %init %{ import_array(); %}
132 %feature("autodoc", "1");
133 %feature("docstring");
135 %newobject ParaMEDMEM::MEDCouplingField::buildMeasureField;
136 %newobject ParaMEDMEM::MEDCouplingField::getLocalizationOfDiscr;
137 %newobject ParaMEDMEM::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
138 %newobject ParaMEDMEM::MEDCouplingFieldDouble::New;
139 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getArray;
140 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getEndArray;
141 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MergeFields;
142 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MeldFields;
143 %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct;
144 %newobject ParaMEDMEM::MEDCouplingFieldDouble::determinant;
145 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenValues;
146 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenVectors;
147 %newobject ParaMEDMEM::MEDCouplingFieldDouble::inverse;
148 %newobject ParaMEDMEM::MEDCouplingFieldDouble::trace;
149 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deviator;
150 %newobject ParaMEDMEM::MEDCouplingFieldDouble::magnitude;
151 %newobject ParaMEDMEM::MEDCouplingFieldDouble::maxPerTuple;
152 %newobject ParaMEDMEM::MEDCouplingFieldDouble::keepSelectedComponents;
153 %newobject ParaMEDMEM::MEDCouplingFieldDouble::extractSlice3D;
154 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DotFields;
155 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dot;
156 %newobject ParaMEDMEM::MEDCouplingFieldDouble::CrossProductFields;
157 %newobject ParaMEDMEM::MEDCouplingFieldDouble::crossProduct;
158 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MaxFields;
159 %newobject ParaMEDMEM::MEDCouplingFieldDouble::max;
160 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MinFields;
161 %newobject ParaMEDMEM::MEDCouplingFieldDouble::AddFields;
162 %newobject ParaMEDMEM::MEDCouplingFieldDouble::SubstractFields;
163 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MultiplyFields;
164 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DivideFields;
165 %newobject ParaMEDMEM::MEDCouplingFieldDouble::min;
166 %newobject ParaMEDMEM::MEDCouplingFieldDouble::negate;
167 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getIdsInRange;
168 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart;
169 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPartRange;
170 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__getitem__;
171 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__neg__;
172 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__add__;
173 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__sub__;
174 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__mul__;
175 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__div__;
176 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__pow__;
177 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__radd__;
178 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rsub__;
179 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rmul__;
180 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rdiv__;
181 %newobject ParaMEDMEM::MEDCouplingFieldDouble::clone;
182 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cloneWithMesh;
183 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy;
184 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
185 %newobject ParaMEDMEM::MEDCouplingFieldDouble::nodeToCellDiscretization;
186 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
187 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
188 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
189 %newobject ParaMEDMEM::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
190 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
191 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfNodesPerCell;
192 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfFacesPerCell;
193 %newobject ParaMEDMEM::MEDCouplingMesh::computeEffectiveNbOfNodesPerCell;
194 %newobject ParaMEDMEM::MEDCouplingMesh::buildPartRange;
195 %newobject ParaMEDMEM::MEDCouplingMesh::giveCellsWithType;
196 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
197 %newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
198 %newobject ParaMEDMEM::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
199 %newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
200 %newobject ParaMEDMEM::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
201 %newobject ParaMEDMEM::MEDCouplingMesh::mergeMyselfWith;
202 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic;
203 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic2;
204 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic3;
205 %newobject ParaMEDMEM::MEDCouplingMesh::getMeasureField;
206 %newobject ParaMEDMEM::MEDCouplingMesh::simplexize;
207 %newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured;
208 %newobject ParaMEDMEM::MEDCouplingMesh::MergeMeshes;
209 %newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer;
210 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellsInBoundingBox;
211 %newobject ParaMEDMEM::MEDCouplingPointSet::findBoundaryNodes;
212 %newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh;
213 %newobject ParaMEDMEM::MEDCouplingPointSet::MergeNodesArray;
214 %newobject ParaMEDMEM::MEDCouplingPointSet::buildPartOfMySelf2;
215 %newobject ParaMEDMEM::MEDCouplingPointSet::BuildInstanceFromMeshType;
216 %newobject ParaMEDMEM::MEDCouplingPointSet::zipConnectivityTraducer;
217 %newobject ParaMEDMEM::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
218 %newobject ParaMEDMEM::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
219 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellIdsLyingOnNodes;
220 %newobject ParaMEDMEM::MEDCouplingPointSet::deepCpyConnectivityOnly;
221 %newobject ParaMEDMEM::MEDCouplingPointSet::getBoundingBoxForBBTree;
222 %newobject ParaMEDMEM::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells;
223 %newobject ParaMEDMEM::MEDCouplingPointSet::__getitem__;
224 %newobject ParaMEDMEM::MEDCouplingUMesh::New;
225 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
226 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
227 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
228 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
229 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
230 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
231 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
232 %newobject ParaMEDMEM::MEDCouplingUMesh::explode3DMeshTo1D;
233 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
234 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
235 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
236 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
237 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
238 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
239 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
240 %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
241 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
242 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
243 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
244 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
245 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
246 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
247 %newobject ParaMEDMEM::MEDCouplingUMesh::convertLinearCellsToQuadratic;
248 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
249 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
250 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
251 %newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField;
252 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner;
253 %newobject ParaMEDMEM::MEDCouplingUMesh::computePlaneEquationOf3DFaces;
254 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField;
255 %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
256 %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
257 %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
258 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
259 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
260 %newobject ParaMEDMEM::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
261 %newobject ParaMEDMEM::MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh;
262 %newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
263 %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
264 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis;
265 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsCrossingPlane;
266 %newobject ParaMEDMEM::MEDCouplingUMesh::convexEnvelop2D;
267 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
268 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf2DMesh;
269 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf3DMesh;
270 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
271 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
272 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
273 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
274 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::New;
275 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::getNodalConnectivity;
276 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
277 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::New;
278 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
279 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::computeDualMesh;
280 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
281 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::sortHexa8EachOther;
282 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
283 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
284 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::New;
285 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
286 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
287 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
288 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
289 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
290 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
291 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::buildStructuredSubPart;
292 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTUnstructured;
293 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
294 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
295 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
296 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
297 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
298 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
299 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
300 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
301 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
302 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
303 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
305 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
306 %feature("unref") MEDCouplingMesh "$this->decrRef();"
307 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
308 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
309 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
310 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
311 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
312 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
313 %feature("unref") MEDCouplingField "$this->decrRef();"
314 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
315 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
316 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
317 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
318 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
319 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
320 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
321 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
322 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
324 %rename(assign) *::operator=;
325 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
326 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
327 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
328 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
332 %rename (InterpKernelException) INTERP_KERNEL::Exception;
334 %include "MEDCouplingRefCountObject.i"
335 %include "MEDCouplingMemArray.i"
353 CONST_ON_TIME_INTERVAL = 7
354 } TypeOfTimeDiscretization;
362 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
363 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11
364 } MEDCouplingMeshType;
367 class DataArrayDouble;
368 class MEDCouplingUMesh;
369 class MEDCouplingFieldDouble;
371 %extend RefCountObject
373 std::string getHiddenCppPointer() const
375 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
380 %extend MEDCouplingGaussLocalization
382 std::string __str__() const throw(INTERP_KERNEL::Exception)
384 return self->getStringRepr();
387 std::string __repr__() const throw(INTERP_KERNEL::Exception)
389 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
390 oss << self->getStringRepr();
397 class MEDCouplingMesh : public RefCountObject, public TimeLabel
400 void setName(const char *name);
401 std::string getName() const;
402 void setDescription(const char *descr);
403 std::string getDescription() const;
404 void setTime(double val, int iteration, int order);
405 void setTimeUnit(const char *unit);
406 const char *getTimeUnit() const;
407 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
408 bool isStructured() const throw(INTERP_KERNEL::Exception);
409 virtual MEDCouplingMesh *deepCpy() const;
410 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
411 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
412 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
413 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
414 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
415 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
416 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
417 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
418 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
419 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
420 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
421 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
422 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
423 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
424 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
425 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
426 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
427 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
428 virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
429 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
430 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
431 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
432 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
433 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
434 void writeVTK(const char *fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
436 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
437 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
438 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
439 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
440 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
441 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
442 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
443 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
444 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
445 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
446 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
447 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
448 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
449 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
450 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
451 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
452 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
455 std::string __str__() const throw(INTERP_KERNEL::Exception)
457 return self->simpleRepr();
460 PyObject *getTime() throw(INTERP_KERNEL::Exception)
463 double tmp0=self->getTime(tmp1,tmp2);
464 PyObject *res = PyList_New(3);
465 PyList_SetItem(res,0,SWIG_From_double(tmp0));
466 PyList_SetItem(res,1,SWIG_From_int(tmp1));
467 PyList_SetItem(res,2,SWIG_From_int(tmp2));
471 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
475 DataArrayDoubleTuple *aa;
476 std::vector<double> bb;
478 int spaceDim=self->getSpaceDimension();
479 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
480 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
481 return self->getCellContainingPoint(pos,eps);
484 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
488 DataArrayDoubleTuple *aa;
489 std::vector<double> bb;
491 int spaceDim=self->getSpaceDimension();
492 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
493 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
494 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
495 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
496 PyObject *ret=PyTuple_New(2);
497 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
498 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
502 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
504 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
505 int spaceDim=self->getSpaceDimension();
507 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
508 if (!SWIG_IsOK(res1))
511 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
512 int nbOfPoints=size/spaceDim;
515 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
517 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
521 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
523 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
524 da2->checkAllocated();
525 int size=da2->getNumberOfTuples();
526 int nbOfCompo=da2->getNumberOfComponents();
527 if(nbOfCompo!=spaceDim)
529 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
531 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
533 PyObject *ret=PyTuple_New(2);
534 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
535 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
539 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
543 DataArrayDoubleTuple *aa;
544 std::vector<double> bb;
546 int spaceDim=self->getSpaceDimension();
547 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
548 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
549 std::vector<int> elts;
550 self->getCellsContainingPoint(pos,eps,elts);
551 DataArrayInt *ret=DataArrayInt::New();
552 ret->alloc((int)elts.size(),1);
553 std::copy(elts.begin(),elts.end(),ret->getPointer());
554 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
557 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
560 int v0; std::vector<int> v1;
561 const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
562 self->renumberCells(ids,check);
565 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
567 DataArrayInt *cellCor, *nodeCor;
568 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
569 PyObject *res = PyList_New(2);
570 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
571 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
575 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
577 DataArrayInt *cellCor=0,*nodeCor=0;
578 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
579 PyObject *res = PyList_New(2);
580 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
581 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
585 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
587 DataArrayInt *cellCor=0;
588 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
592 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
595 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
596 if (!SWIG_IsOK(res1))
599 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
600 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
604 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
606 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
607 da2->checkAllocated();
608 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
611 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
613 std::vector<int> conn;
614 self->getNodeIdsOfCell(cellId,conn);
615 return convertIntArrToPyList2(conn);
618 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
620 std::vector<double> coo;
621 self->getCoordinatesOfNode(nodeId,coo);
622 return convertDblArrToPyList2(coo);
625 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
629 DataArrayDoubleTuple *aa;
630 std::vector<double> bb;
632 int spaceDim=self->getSpaceDimension();
633 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
634 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
635 self->scale(pointPtr,factor);
638 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
640 int spaceDim=self->getSpaceDimension();
641 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
642 self->getBoundingBox(tmp);
643 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
647 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
650 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
651 PyObject *ret=PyTuple_New(2);
652 PyObject *ret0Py=ret0?Py_True:Py_False;
654 PyTuple_SetItem(ret,0,ret0Py);
655 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
659 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
661 int szArr,sw,iTypppArr;
662 std::vector<int> stdvecTyyppArr;
663 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
664 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
665 if(sw==3)//DataArrayInt
667 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
668 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
669 std::string name=argpt->getName();
671 ret->setName(name.c_str());
673 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
676 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
678 int szArr,sw,iTypppArr;
679 std::vector<int> stdvecTyyppArr;
681 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
682 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
683 if(sw==3)//DataArrayInt
685 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
686 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
687 std::string name=argpt->getName();
689 ret->setName(name.c_str());
692 PyObject *res = PyList_New(2);
693 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
694 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
695 PyList_SetItem(res,0,obj0);
696 PyList_SetItem(res,1,obj1);
700 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
704 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
705 PyObject *res = PyTuple_New(2);
706 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
709 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
711 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
712 PyTuple_SetItem(res,0,obj0);
713 PyTuple_SetItem(res,1,obj1);
717 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
719 std::vector<int> vals=self->getDistributionOfTypes();
721 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
722 PyObject *ret=PyList_New((int)vals.size()/3);
723 for(int j=0;j<(int)vals.size()/3;j++)
725 PyObject *ret1=PyList_New(3);
726 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
727 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
728 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
729 PyList_SetItem(ret,j,ret1);
734 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
736 std::vector<int> code;
737 std::vector<const DataArrayInt *> idsPerType;
738 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
739 convertPyToNewIntArr4(li,1,3,code);
740 return self->checkTypeConsistencyAndContig(code,idsPerType);
743 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
745 std::vector<int> code;
746 std::vector<DataArrayInt *> idsInPflPerType;
747 std::vector<DataArrayInt *> idsPerType;
748 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
749 PyObject *ret=PyTuple_New(3);
752 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
753 PyObject *ret0=PyList_New((int)code.size()/3);
754 for(int j=0;j<(int)code.size()/3;j++)
756 PyObject *ret00=PyList_New(3);
757 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
758 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
759 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
760 PyList_SetItem(ret0,j,ret00);
762 PyTuple_SetItem(ret,0,ret0);
764 PyObject *ret1=PyList_New(idsInPflPerType.size());
765 for(std::size_t j=0;j<idsInPflPerType.size();j++)
766 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
767 PyTuple_SetItem(ret,1,ret1);
768 int n=idsPerType.size();
769 PyObject *ret2=PyList_New(n);
771 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
772 PyTuple_SetItem(ret,2,ret2);
776 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
780 DataArrayDoubleTuple *aa;
781 std::vector<double> bb;
783 int spaceDim=self->getSpaceDimension();
784 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
785 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
786 self->translate(vectorPtr);
789 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
791 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
794 DataArrayDoubleTuple *aa;
795 std::vector<double> bb;
797 int spaceDim=self->getSpaceDimension();
798 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
799 self->rotate(centerPtr,0,alpha);
802 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
804 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
806 DataArrayDouble *a,*a2;
807 DataArrayDoubleTuple *aa,*aa2;
808 std::vector<double> bb,bb2;
810 int spaceDim=self->getSpaceDimension();
811 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
812 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
813 self->rotate(centerPtr,vectorPtr,alpha);
816 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
818 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
819 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
820 PyObject *res=PyList_New(result.size());
821 for(int i=0;iL!=result.end(); i++, iL++)
822 PyList_SetItem(res,i,PyInt_FromLong(*iL));
826 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
828 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
829 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
830 return MEDCouplingMesh::MergeMeshes(tmp);
836 //== MEDCouplingMesh End
838 %include "NormalizedGeometricTypes"
839 %include "MEDCouplingNatureOfFieldEnum"
843 class MEDCouplingNatureOfField
846 static const char *GetRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception);
847 static std::string GetReprNoThrow(NatureOfField nat);
848 static std::string GetAllPossibilitiesStr();
852 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
853 // include "MEDCouplingTimeDiscretization.i"
857 class MEDCouplingGaussLocalization
860 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
861 const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
862 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
863 INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
864 void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
865 int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
866 int getDimension() const throw(INTERP_KERNEL::Exception);
867 int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
868 std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
869 void checkCoherency() const throw(INTERP_KERNEL::Exception);
870 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception);
872 const std::vector<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
873 double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
874 const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
875 double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
876 const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
877 double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
878 void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
879 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
880 void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
881 void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
882 void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
883 void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
885 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
889 %include "MEDCouplingFieldDiscretization.i"
891 //== MEDCouplingPointSet
895 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
898 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
899 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
900 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
901 void zipCoords() throw(INTERP_KERNEL::Exception);
902 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
903 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
904 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
905 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
906 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
907 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
908 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
909 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
910 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
911 static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception);
912 virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
913 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
914 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
915 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
916 virtual DataArrayInt *findBoundaryNodes() const;
917 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
918 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
919 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
920 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
921 virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
922 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
925 std::string __str__() const throw(INTERP_KERNEL::Exception)
927 return self->simpleRepr();
930 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
933 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
934 PyObject *res = PyList_New(2);
935 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
936 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
940 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
942 DataArrayInt *comm, *commIndex;
943 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
944 PyObject *res = PyList_New(2);
945 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
946 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
950 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
952 DataArrayDouble *ret1=self->getCoords();
955 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
958 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
960 int szArr,sw,iTypppArr;
961 std::vector<int> stdvecTyyppArr;
962 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
963 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
964 if(sw==3)//DataArrayInt
966 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
967 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
968 std::string name=argpt->getName();
970 ret->setName(name.c_str());
972 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
975 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
977 int szArr,sw,iTypppArr;
978 std::vector<int> stdvecTyyppArr;
979 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
980 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
981 if(sw==3)//DataArrayInt
983 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
984 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
985 std::string name=argpt->getName();
987 ret->setName(name.c_str());
989 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
992 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
994 int szArr,sw,iTypppArr;
995 std::vector<int> stdvecTyyppArr;
996 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
997 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
998 if(sw==3)//DataArrayInt
1000 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1001 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1002 std::string name=argpt->getName();
1004 ret->setName(name.c_str());
1006 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1009 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1011 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1012 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1015 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1017 int szArr,sw,iTypppArr;
1018 std::vector<int> stdvecTyyppArr;
1019 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1020 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1021 if(sw==3)//DataArrayInt
1023 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1024 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1025 std::string name=argpt->getName();
1027 ret->setName(name.c_str());
1029 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1032 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1034 int szArr,sw,iTypppArr;
1035 std::vector<int> stdvecTyyppArr;
1036 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1037 self->renumberNodes(tmp,newNbOfNodes);
1040 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1042 int szArr,sw,iTypppArr;
1043 std::vector<int> stdvecTyyppArr;
1044 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1045 self->renumberNodes2(tmp,newNbOfNodes);
1048 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1050 int spaceDim=self->getSpaceDimension();
1052 DataArrayDouble *a,*a2;
1053 DataArrayDoubleTuple *aa,*aa2;
1054 std::vector<double> bb,bb2;
1056 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1057 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1058 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1059 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1060 std::vector<int> nodes;
1061 self->findNodesOnLine(p,v,eps,nodes);
1062 DataArrayInt *ret=DataArrayInt::New();
1063 ret->alloc((int)nodes.size(),1);
1064 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1065 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1067 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1069 int spaceDim=self->getSpaceDimension();
1071 DataArrayDouble *a,*a2;
1072 DataArrayDoubleTuple *aa,*aa2;
1073 std::vector<double> bb,bb2;
1075 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1076 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1077 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1078 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1079 std::vector<int> nodes;
1080 self->findNodesOnPlane(p,v,eps,nodes);
1081 DataArrayInt *ret=DataArrayInt::New();
1082 ret->alloc((int)nodes.size(),1);
1083 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1084 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1087 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1091 DataArrayDoubleTuple *aa;
1092 std::vector<double> bb;
1094 int spaceDim=self->getSpaceDimension();
1095 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1096 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1097 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1098 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1101 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1103 DataArrayInt *c=0,*cI=0;
1107 DataArrayDoubleTuple *aa;
1108 std::vector<double> bb;
1110 int spaceDim=self->getSpaceDimension();
1111 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1112 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1113 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1114 PyObject *ret=PyTuple_New(2);
1115 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1116 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1120 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1122 DataArrayInt *c=0,*cI=0;
1123 int spaceDim=self->getSpaceDimension();
1126 DataArrayDoubleTuple *aa;
1127 std::vector<double> bb;
1130 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1131 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1133 PyObject *ret=PyTuple_New(2);
1134 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1135 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1139 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1143 DataArrayDoubleTuple *aa;
1144 std::vector<double> bb;
1146 int spaceDim=self->getSpaceDimension();
1147 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1148 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1150 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1151 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1154 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1158 std::vector<int> multiVal;
1159 std::pair<int, std::pair<int,int> > slic;
1160 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1161 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1165 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1167 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1169 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1171 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1175 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
1177 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
1178 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
1179 self->getReverseNodalConnectivity(d0,d1);
1180 PyObject *ret=PyTuple_New(2);
1181 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1182 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1186 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1188 DataArrayInt *v0=0,*v1=0;
1189 self->findCommonCells(compType,startCellId,v0,v1);
1190 PyObject *res = PyList_New(2);
1191 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1192 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1197 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1200 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1201 if (!SWIG_IsOK(res1))
1204 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1205 self->renumberNodesInConn(tmp);
1209 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1211 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1212 da2->checkAllocated();
1213 self->renumberNodesInConn(da2->getConstPointer());
1217 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1220 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1221 PyObject *ret=PyTuple_New(2);
1222 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1223 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1227 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1229 DataArrayInt *ret=0;
1231 int szArr,sw,iTypppArr;
1232 std::vector<int> stdvecTyyppArr;
1233 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1234 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1238 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1242 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1243 PyObject *res = PyList_New(3);
1244 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1245 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1246 PyList_SetItem(res,2,SWIG_From_int(ret2));
1250 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1254 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1255 PyObject *res = PyList_New(3);
1256 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1257 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1258 PyList_SetItem(res,2,SWIG_From_int(ret2));
1262 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1265 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1266 if (!SWIG_IsOK(res1))
1269 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1270 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1274 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1276 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1277 da2->checkAllocated();
1278 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1282 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1286 std::vector<int> multiVal;
1287 std::pair<int, std::pair<int,int> > slic;
1288 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1289 int nbc=self->getNumberOfCells();
1290 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1297 std::ostringstream oss;
1298 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1299 throw INTERP_KERNEL::Exception(oss.str().c_str());
1302 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1307 int tmp=nbc+singleVal;
1308 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1312 std::ostringstream oss;
1313 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1314 throw INTERP_KERNEL::Exception(oss.str().c_str());
1320 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1324 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1329 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1330 daIntTyypp->checkAllocated();
1331 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1334 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1338 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1341 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1342 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1343 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1344 for(int i=0;i<sz;i++)
1345 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1348 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1351 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1353 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1354 std::vector<double> val3;
1355 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1356 "Rotate2DAlg",2,true,nbNodes);
1358 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1359 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1362 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1365 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1366 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1367 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1368 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1369 for(int i=0;i<sz;i++)
1370 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1373 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1376 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1378 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1379 std::vector<double> val3;
1380 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1381 "Rotate3DAlg",3,true,nbNodes);
1383 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1384 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1385 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1390 //== MEDCouplingPointSet End
1392 class MEDCouplingUMeshCell
1395 INTERP_KERNEL::NormalizedCellType getType() const;
1398 std::string __str__() const throw(INTERP_KERNEL::Exception)
1400 return self->repr();
1403 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1406 const int *r=self->getAllConn(ret2);
1407 PyObject *ret=PyTuple_New(ret2);
1408 for(int i=0;i<ret2;i++)
1409 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1415 class MEDCouplingUMeshCellIterator
1422 MEDCouplingUMeshCell *ret=self->nextt();
1424 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1427 PyErr_SetString(PyExc_StopIteration,"No more data.");
1434 class MEDCouplingUMeshCellByTypeIterator
1437 ~MEDCouplingUMeshCellByTypeIterator();
1442 MEDCouplingUMeshCellEntry *ret=self->nextt();
1444 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1447 PyErr_SetString(PyExc_StopIteration,"No more data.");
1454 class MEDCouplingUMeshCellByTypeEntry
1457 ~MEDCouplingUMeshCellByTypeEntry();
1460 MEDCouplingUMeshCellByTypeIterator *__iter__()
1462 return self->iterator();
1467 class MEDCouplingUMeshCellEntry
1470 INTERP_KERNEL::NormalizedCellType getType() const;
1471 int getNumberOfElems() const;
1474 MEDCouplingUMeshCellIterator *__iter__()
1476 return self->iterator();
1481 //== MEDCouplingUMesh
1483 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1486 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1487 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1488 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1489 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1490 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1491 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1492 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1493 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1494 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1495 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1496 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1497 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1498 void computeTypes() throw(INTERP_KERNEL::Exception);
1499 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1500 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1502 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1503 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1504 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1505 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1506 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1507 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1508 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1509 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1510 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1511 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1512 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1513 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1514 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1515 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1516 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1517 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1518 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1519 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1520 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1521 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1522 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1523 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1524 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1525 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1526 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1527 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1528 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1529 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1530 DataArrayDouble *computePlaneEquationOf3DFaces() const throw(INTERP_KERNEL::Exception);
1531 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1532 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1533 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1534 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1535 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1536 DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1537 DataArrayInt *buildUnionOf2DMesh() const throw(INTERP_KERNEL::Exception);
1538 DataArrayInt *buildUnionOf3DMesh() const throw(INTERP_KERNEL::Exception);
1539 DataArrayDouble *getBoundingBoxForBBTreeFast() const throw(INTERP_KERNEL::Exception);
1540 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1541 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1542 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1543 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1544 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1545 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1547 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1549 return MEDCouplingUMesh::New();
1552 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1554 return MEDCouplingUMesh::New(meshName,meshDim);
1557 std::string __str__() const throw(INTERP_KERNEL::Exception)
1559 return self->simpleRepr();
1562 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1564 std::ostringstream oss;
1565 self->reprQuickOverview(oss);
1569 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1571 return self->cellIterator();
1574 PyObject *getAllGeoTypesSorted() const throw(INTERP_KERNEL::Exception)
1576 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
1577 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1578 PyObject *res=PyList_New(result.size());
1579 for(int i=0;iL!=result.end(); i++, iL++)
1580 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1584 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1588 std::vector<int> multiVal;
1589 std::pair<int, std::pair<int,int> > slic;
1590 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1591 int nbc=self->getNumberOfCells();
1592 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1599 std::ostringstream oss;
1600 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1601 throw INTERP_KERNEL::Exception(oss.str().c_str());
1605 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1612 int tmp=nbc+singleVal;
1613 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1618 std::ostringstream oss;
1619 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1620 throw INTERP_KERNEL::Exception(oss.str().c_str());
1626 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1632 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1633 daIntTyypp->checkAllocated();
1634 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1638 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1642 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1646 std::vector<int> multiVal;
1647 std::pair<int, std::pair<int,int> > slic;
1648 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1649 int nbc=self->getNumberOfCells();
1650 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1657 std::ostringstream oss;
1658 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1659 throw INTERP_KERNEL::Exception(oss.str().c_str());
1663 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1670 int tmp=nbc+singleVal;
1671 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1676 std::ostringstream oss;
1677 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1678 throw INTERP_KERNEL::Exception(oss.str().c_str());
1684 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1689 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1695 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1696 daIntTyypp->checkAllocated();
1697 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1701 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1705 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1707 int szArr,sw,iTypppArr;
1708 std::vector<int> stdvecTyyppArr;
1709 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1712 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1713 throw INTERP_KERNEL::Exception(oss.str().c_str());
1715 self->insertNextCell(type,size,tmp);
1718 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1720 int szArr,sw,iTypppArr;
1721 std::vector<int> stdvecTyyppArr;
1722 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1723 self->insertNextCell(type,szArr,tmp);
1726 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1728 DataArrayInt *ret=self->getNodalConnectivity();
1733 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1735 DataArrayInt *ret=self->getNodalConnectivityIndex();
1741 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1743 int szArr,sw,iTypppArr;
1744 std::vector<int> stdvecTyyppArr;
1745 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1746 int nbOfDepthPeelingPerformed=0;
1747 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1748 PyObject *res=PyTuple_New(2);
1749 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1750 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1754 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1756 DataArrayInt *v0=0,*v1=0;
1757 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1758 PyObject *res = PyList_New(2);
1759 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1760 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1764 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1768 DataArrayDoubleTuple *aa;
1769 std::vector<double> bb;
1771 int nbOfCompo=self->getSpaceDimension();
1772 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1775 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1776 PyObject *ret=PyTuple_New(2);
1777 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1778 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1782 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1784 DataArrayInt *ret1=0;
1785 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1786 PyObject *ret=PyTuple_New(2);
1787 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1788 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1792 PyObject *tetrahedrize(int policy) throw(INTERP_KERNEL::Exception)
1795 DataArrayInt *ret1(0);
1796 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
1797 PyObject *ret=PyTuple_New(3);
1798 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
1799 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1800 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
1804 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1806 std::vector<int> cells;
1807 self->checkButterflyCells(cells,eps);
1808 DataArrayInt *ret=DataArrayInt::New();
1809 ret->alloc((int)cells.size(),1);
1810 std::copy(cells.begin(),cells.end(),ret->getPointer());
1811 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1814 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1816 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1818 PyObject *ret = PyList_New(sz);
1819 for(int i=0;i<sz;i++)
1820 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1824 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1826 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1827 int sz=retCpp.size();
1828 PyObject *ret=PyList_New(sz);
1829 for(int i=0;i<sz;i++)
1830 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1834 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1837 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1838 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1839 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1842 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1845 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1846 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1850 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1853 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1854 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1858 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1860 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1861 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1862 PyObject *ret=PyTuple_New(3);
1863 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1864 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1865 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1869 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1871 DataArrayInt *tmp0=0,*tmp1=0;
1872 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1873 PyObject *ret=PyTuple_New(2);
1874 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1875 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1879 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1883 std::vector<int> multiVal;
1884 std::pair<int, std::pair<int,int> > slic;
1885 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1886 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1890 return self->duplicateNodes(&singleVal,&singleVal+1);
1892 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
1894 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
1896 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1900 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
1904 std::vector<int> multiVal;
1905 std::pair<int, std::pair<int,int> > slic;
1906 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1907 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1911 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
1913 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
1915 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
1917 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1921 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
1924 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1925 DataArrayInt *tmp0,*tmp1=0;
1926 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
1927 PyObject *ret=PyTuple_New(2);
1928 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1929 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1933 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const throw(INTERP_KERNEL::Exception)
1935 DataArrayInt *ret0=0,*ret1=0;
1936 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
1937 PyObject *ret=PyTuple_New(2);
1938 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1939 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1943 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1945 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1946 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1947 DataArrayInt *ret1=0,*ret2=0;
1948 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
1949 PyObject *ret=PyTuple_New(3);
1950 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1951 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1952 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1956 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1958 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1959 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1960 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
1961 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1964 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
1967 std::vector<const MEDCouplingUMesh *> meshes;
1968 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1969 std::vector<DataArrayInt *> corr;
1970 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
1972 PyObject *ret1=PyList_New(sz);
1973 for(int i=0;i<sz;i++)
1974 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1975 PyObject *ret=PyList_New(2);
1976 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1977 PyList_SetItem(ret,1,ret1);
1981 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1983 std::vector<MEDCouplingUMesh *> meshes;
1984 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1985 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
1988 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
1990 std::vector<MEDCouplingUMesh *> meshes;
1991 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1992 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
1995 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
1999 std::vector<int> multiVal;
2000 std::pair<int, std::pair<int,int> > slic;
2001 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2003 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2004 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2008 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2010 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2012 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2014 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2018 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2020 DataArrayInt *arrOut=0,*arrIndexOut=0;
2023 std::vector<int> multiVal;
2024 std::pair<int, std::pair<int,int> > slic;
2025 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2027 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2028 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2033 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2038 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2043 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2047 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2049 PyObject *ret=PyTuple_New(2);
2050 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2051 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2055 static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2057 DataArrayInt *arrOut=0,*arrIndexOut=0;
2058 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2059 PyObject *ret=PyTuple_New(2);
2060 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2061 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2065 static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2067 if(!PySlice_Check(slic))
2068 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !");
2069 Py_ssize_t strt=2,stp=2,step=2;
2070 PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
2072 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !");
2073 arrIndxIn->checkAllocated();
2074 if(arrIndxIn->getNumberOfComponents()!=1)
2075 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !");
2076 if(PySlice_GetIndices(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step)!=0)
2077 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !");
2078 DataArrayInt *arrOut=0,*arrIndexOut=0;
2079 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2080 PyObject *ret=PyTuple_New(2);
2081 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2082 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2086 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2087 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2088 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2090 DataArrayInt *arrOut=0,*arrIndexOut=0;
2093 std::vector<int> multiVal;
2094 std::pair<int, std::pair<int,int> > slic;
2095 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2097 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2098 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2103 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2108 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2113 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2117 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2119 PyObject *ret=PyTuple_New(2);
2120 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2121 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2125 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2126 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2130 std::vector<int> multiVal;
2131 std::pair<int, std::pair<int,int> > slic;
2132 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2134 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2135 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2140 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2145 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2150 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2154 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2158 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2162 DataArrayDoubleTuple *aa;
2163 std::vector<double> bb;
2165 int spaceDim=self->getSpaceDimension();
2166 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2167 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2169 std::vector<int> cells;
2170 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2171 DataArrayInt *ret=DataArrayInt::New();
2172 ret->alloc((int)cells.size(),1);
2173 std::copy(cells.begin(),cells.end(),ret->getPointer());
2174 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2177 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2181 DataArrayDoubleTuple *aa;
2182 std::vector<double> bb;
2184 int spaceDim=self->getSpaceDimension();
2185 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2186 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2187 self->orientCorrectly2DCells(v,polyOnly);
2190 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2192 std::vector<int> cells;
2193 self->arePolyhedronsNotCorrectlyOriented(cells);
2194 DataArrayInt *ret=DataArrayInt::New();
2195 ret->alloc((int)cells.size(),1);
2196 std::copy(cells.begin(),cells.end(),ret->getPointer());
2197 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2200 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2204 self->getFastAveragePlaneOfThis(vec,pos);
2206 std::copy(vec,vec+3,vals);
2207 std::copy(pos,pos+3,vals+3);
2208 return convertDblArrToPyListOfTuple(vals,3,2);
2211 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2213 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2214 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2215 return MEDCouplingUMesh::MergeUMeshes(tmp);
2218 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2221 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2222 PyObject *ret=PyTuple_New(2);
2223 PyObject *ret0Py=ret0?Py_True:Py_False;
2225 PyTuple_SetItem(ret,0,ret0Py);
2226 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2230 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2233 bool ret0=self->areCellsIncludedIn2(other,ret1);
2234 PyObject *ret=PyTuple_New(2);
2235 PyObject *ret0Py=ret0?Py_True:Py_False;
2237 PyTuple_SetItem(ret,0,ret0Py);
2238 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2242 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2244 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2245 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2246 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2247 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2248 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2249 PyObject *ret=PyTuple_New(5);
2250 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2251 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2252 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2253 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2254 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2258 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2260 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2261 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2262 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2263 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2264 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2265 PyObject *ret=PyTuple_New(5);
2266 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2267 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2268 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2269 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2270 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2274 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2276 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2277 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2278 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2279 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2280 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2281 PyObject *ret=PyTuple_New(5);
2282 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2283 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2284 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2285 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2286 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2290 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2292 DataArrayInt *neighbors=0,*neighborsIdx=0;
2293 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2294 PyObject *ret=PyTuple_New(2);
2295 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2296 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2300 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2302 DataArrayInt *neighbors=0,*neighborsIdx=0;
2303 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2304 PyObject *ret=PyTuple_New(2);
2305 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2306 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2310 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2312 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2313 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2314 DataArrayInt *d2,*d3,*d4,*dd5;
2315 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2316 PyObject *ret=PyTuple_New(7);
2317 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2318 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2319 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2320 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2321 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2322 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2323 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2327 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2330 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2331 da->checkAllocated();
2332 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2335 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2338 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2339 da->checkAllocated();
2340 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2343 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2346 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2347 da->checkAllocated();
2348 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2351 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2354 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2355 da->checkAllocated();
2356 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2357 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2358 PyObject *res = PyList_New(result.size());
2359 for (int i=0;iL!=result.end(); i++, iL++)
2360 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2364 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2367 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2368 da->checkAllocated();
2369 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2370 ret->setName(da->getName().c_str());
2374 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2376 DataArrayInt *cellNb1=0,*cellNb2=0;
2377 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2378 PyObject *ret=PyTuple_New(3);
2379 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2380 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2381 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2385 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2387 int spaceDim=self->getSpaceDimension();
2389 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2391 DataArrayDouble *a,*a2;
2392 DataArrayDoubleTuple *aa,*aa2;
2393 std::vector<double> bb,bb2;
2395 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2396 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2397 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2398 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2400 DataArrayInt *cellIds=0;
2401 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2402 PyObject *ret=PyTuple_New(2);
2403 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2404 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2408 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2410 int spaceDim=self->getSpaceDimension();
2412 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2414 DataArrayDouble *a,*a2;
2415 DataArrayDoubleTuple *aa,*aa2;
2416 std::vector<double> bb,bb2;
2418 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2419 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2420 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2421 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2423 DataArrayInt *cellIds=0;
2424 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2425 PyObject *ret=PyTuple_New(2);
2426 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2427 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2431 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2433 int spaceDim=self->getSpaceDimension();
2435 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2437 DataArrayDouble *a,*a2;
2438 DataArrayDoubleTuple *aa,*aa2;
2439 std::vector<double> bb,bb2;
2441 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2442 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2443 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2444 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2445 return self->getCellIdsCrossingPlane(orig,vect,eps);
2448 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2452 std::vector<int> pos2;
2453 DataArrayInt *pos3=0;
2454 DataArrayIntTuple *pos4=0;
2455 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2460 self->convertToPolyTypes(&pos1,&pos1+1);
2467 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2472 self->convertToPolyTypes(pos3->begin(),pos3->end());
2476 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2480 void convertAllToPoly();
2481 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2482 bool unPolyze() throw(INTERP_KERNEL::Exception);
2483 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2484 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2485 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2488 //== MEDCouplingUMesh End
2490 //== MEDCouplingExtrudedMesh
2492 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2495 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2496 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2498 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2500 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2503 std::string __str__() const throw(INTERP_KERNEL::Exception)
2505 return self->simpleRepr();
2508 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2510 std::ostringstream oss;
2511 self->reprQuickOverview(oss);
2515 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2517 MEDCouplingUMesh *ret=self->getMesh2D();
2520 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2522 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2524 MEDCouplingUMesh *ret=self->getMesh1D();
2527 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2529 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2531 DataArrayInt *ret=self->getMesh3DIds();
2534 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2539 //== MEDCouplingExtrudedMesh End
2541 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2544 static MEDCoupling1GTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2545 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2546 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2547 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2548 virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2549 virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
2552 virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2554 int szArr,sw,iTypppArr;
2555 std::vector<int> stdvecTyyppArr;
2556 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2557 self->insertNextCell(tmp,tmp+szArr);
2560 virtual DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2562 DataArrayInt *ret=self->getNodalConnectivity();
2563 if(ret) ret->incrRef();
2567 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2569 std::vector< const MEDCoupling1GTUMesh *> parts;
2570 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
2571 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
2576 //== MEDCoupling1SGTUMesh
2578 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2581 static MEDCoupling1SGTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2582 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2583 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2584 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2585 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2586 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2587 MEDCoupling1GTUMesh *computeDualMesh() const throw(INTERP_KERNEL::Exception);
2588 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const throw(INTERP_KERNEL::Exception);
2589 DataArrayInt *sortHexa8EachOther() throw(INTERP_KERNEL::Exception);
2592 MEDCoupling1SGTUMesh(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2594 return MEDCoupling1SGTUMesh::New(name,type);
2597 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2599 return MEDCoupling1SGTUMesh::New(m);
2602 std::string __str__() const throw(INTERP_KERNEL::Exception)
2604 return self->simpleRepr();
2607 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2609 std::ostringstream oss;
2610 self->reprQuickOverview(oss);
2614 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2616 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2617 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2618 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2621 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2623 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2624 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2625 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2630 //== MEDCoupling1SGTUMesh End
2632 //== MEDCoupling1DGTUMesh
2634 class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2637 static MEDCoupling1DGTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2638 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2639 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
2640 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2641 bool isPacked() const throw(INTERP_KERNEL::Exception);
2644 MEDCoupling1DGTUMesh(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2646 return MEDCoupling1DGTUMesh::New(name,type);
2649 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2651 return MEDCoupling1DGTUMesh::New(m);
2654 std::string __str__() const throw(INTERP_KERNEL::Exception)
2656 return self->simpleRepr();
2659 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2661 std::ostringstream oss;
2662 self->reprQuickOverview(oss);
2666 DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
2668 DataArrayInt *ret=self->getNodalConnectivityIndex();
2669 if(ret) ret->incrRef();
2673 PyObject *retrievePackedNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2675 DataArrayInt *ret1=0,*ret2=0;
2676 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
2677 PyObject *ret0Py=ret0?Py_True:Py_False;
2679 PyObject *ret=PyTuple_New(3);
2680 PyTuple_SetItem(ret,0,ret0Py);
2681 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2682 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2686 PyObject *copyWithNodalConnectivityPacked() const throw(INTERP_KERNEL::Exception)
2689 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
2690 PyObject *ret=PyTuple_New(2);
2691 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
2692 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
2693 PyTuple_SetItem(ret,1,ret1Py);
2697 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2699 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2700 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2701 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
2704 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2706 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2707 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2708 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
2711 static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt) throw(INTERP_KERNEL::Exception)
2713 std::vector<const ParaMEDMEM::DataArrayInt *> tmp;
2714 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2715 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
2720 //== MEDCoupling1DGTUMeshEnd
2722 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2725 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2726 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2727 virtual std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2728 std::vector<int> getCellGridStructure() const throw(INTERP_KERNEL::Exception);
2729 MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception);
2730 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
2733 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const throw(INTERP_KERNEL::Exception)
2735 int tmpp1=-1,tmpp2=-1;
2736 std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
2737 std::vector< std::pair<int,int> > inp;
2741 for(int i=0;i<tmpp1;i++)
2742 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2747 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
2748 inp.resize(tmpp1/2);
2749 for(int i=0;i<tmpp1/2;i++)
2750 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2753 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
2754 return self->buildStructuredSubPart(inp);
2757 static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) throw(INTERP_KERNEL::Exception)
2759 int tmpp1=-1,tmpp2=-1;
2760 std::vector<int> tmp=fillArrayWithPyListInt2(part,tmpp1,tmpp2);
2761 std::vector< std::pair<int,int> > inp;
2765 for(int i=0;i<tmpp1;i++)
2766 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2771 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.BuildExplicitIdsFrom : invalid input size ! Must be even size !");
2772 inp.resize(tmpp1/2);
2773 for(int i=0;i<tmpp1/2;i++)
2774 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2777 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.BuildExplicitIdsFrom : invalid input size !");
2779 int szArr,sw,iTypppArr;
2780 std::vector<int> stdvecTyyppArr;
2781 const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
2782 std::vector<int> tmp5(tmp4,tmp4+szArr);
2784 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
2787 static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) throw(INTERP_KERNEL::Exception)
2789 int szArr,sw,iTypppArr;
2790 std::vector<int> stdvecTyyppArr;
2791 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2792 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
2795 static PyObject *IsPartStructured(PyObject *li, PyObject *st) throw(INTERP_KERNEL::Exception)
2797 int szArr,sw,iTypppArr;
2798 std::vector<int> stdvecTyyppArr;
2799 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2800 int szArr2,sw2,iTypppArr2;
2801 std::vector<int> stdvecTyyppArr2;
2802 const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
2803 std::vector<int> tmp3(tmp2,tmp2+szArr2);
2804 std::vector< std::pair<int,int> > partCompactFormat;
2805 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
2806 PyObject *ret=PyTuple_New(2);
2807 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
2808 PyTuple_SetItem(ret,0,ret0Py);
2809 PyObject *ret1Py=PyList_New(partCompactFormat.size());
2810 for(std::size_t i=0;i<partCompactFormat.size();i++)
2812 PyObject *tmp4=PyTuple_New(2);
2813 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
2814 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
2815 PyList_SetItem(ret1Py,i,tmp4);
2817 PyTuple_SetItem(ret,1,ret1Py);
2823 //== MEDCouplingCMesh
2825 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2828 static MEDCouplingCMesh *New();
2829 static MEDCouplingCMesh *New(const char *meshName);
2830 MEDCouplingCMesh *clone(bool recDeepCpy) const;
2831 void setCoords(const DataArrayDouble *coordsX,
2832 const DataArrayDouble *coordsY=0,
2833 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
2834 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
2838 return MEDCouplingCMesh::New();
2840 MEDCouplingCMesh(const char *meshName)
2842 return MEDCouplingCMesh::New(meshName);
2844 std::string __str__() const throw(INTERP_KERNEL::Exception)
2846 return self->simpleRepr();
2848 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2850 std::ostringstream oss;
2851 self->reprQuickOverview(oss);
2854 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
2856 DataArrayDouble *ret=self->getCoordsAt(i);
2864 //== MEDCouplingCMesh End
2866 //== MEDCouplingCurveLinearMesh
2868 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2871 static MEDCouplingCurveLinearMesh *New();
2872 static MEDCouplingCurveLinearMesh *New(const char *meshName);
2873 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
2874 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
2876 MEDCouplingCurveLinearMesh()
2878 return MEDCouplingCurveLinearMesh::New();
2880 MEDCouplingCurveLinearMesh(const char *meshName)
2882 return MEDCouplingCurveLinearMesh::New(meshName);
2884 std::string __str__() const throw(INTERP_KERNEL::Exception)
2886 return self->simpleRepr();
2888 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2890 std::ostringstream oss;
2891 self->reprQuickOverview(oss);
2894 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
2896 DataArrayDouble *ret=self->getCoords();
2901 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
2903 int szArr,sw,iTypppArr;
2904 std::vector<int> stdvecTyyppArr;
2905 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
2906 self->setNodeGridStructure(tmp,tmp+szArr);
2911 //== MEDCouplingCurveLinearMesh End
2914 namespace ParaMEDMEM
2916 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
2919 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
2920 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
2921 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2922 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2923 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
2924 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
2925 void setName(const char *name) throw(INTERP_KERNEL::Exception);
2926 std::string getDescription() const throw(INTERP_KERNEL::Exception);
2927 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
2928 std::string getName() const throw(INTERP_KERNEL::Exception);
2929 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
2930 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
2931 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
2932 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
2933 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
2934 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
2935 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
2936 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
2937 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
2938 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
2939 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
2940 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
2941 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
2942 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
2943 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
2944 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
2946 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
2948 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
2951 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
2954 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
2956 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
2959 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
2962 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
2964 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
2965 return convertIntArrToPyList3(ret);
2968 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
2971 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
2972 PyObject *ret=PyTuple_New(2);
2973 PyObject *ret0Py=ret0?Py_True:Py_False;
2975 PyTuple_SetItem(ret,0,ret0Py);
2976 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2980 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
2982 DataArrayInt *ret1=0;
2983 MEDCouplingMesh *ret0=0;
2985 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2986 if (!SWIG_IsOK(res1))
2989 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2990 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
2994 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2996 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2997 da2->checkAllocated();
2998 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3000 PyObject *res = PyList_New(2);
3001 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3002 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3006 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
3008 DataArrayInt *ret1=0;
3010 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3011 PyObject *res=PyTuple_New(2);
3012 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3014 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3017 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3018 PyTuple_SetItem(res,1,res1);
3023 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3026 int v0; std::vector<int> v1;
3027 const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
3028 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3031 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3032 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3035 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3036 if (!SWIG_IsOK(res1))
3039 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3040 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3044 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3046 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3047 da2->checkAllocated();
3048 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3052 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3054 std::vector<int> tmp;
3055 self->getCellIdsHavingGaussLocalization(locId,tmp);
3056 DataArrayInt *ret=DataArrayInt::New();
3057 ret->alloc((int)tmp.size(),1);
3058 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3059 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3062 int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
3064 std::vector<int> inp0;
3065 convertPyToNewIntArr4(code,1,3,inp0);
3066 std::vector<const DataArrayInt *> inp1;
3067 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(idsPerType,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",inp1);
3068 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3073 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3076 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3077 static MEDCouplingFieldTemplate *New(TypeOfField type);
3078 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3079 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3082 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3084 return MEDCouplingFieldTemplate::New(f);
3087 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3089 return MEDCouplingFieldTemplate::New(type);
3092 std::string __str__() const throw(INTERP_KERNEL::Exception)
3094 return self->simpleRepr();
3097 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3099 std::ostringstream oss;
3100 self->reprQuickOverview(oss);
3106 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3109 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3110 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3111 void setTimeUnit(const char *unit);
3112 const char *getTimeUnit() const;
3113 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3114 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3115 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3116 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3117 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3118 void writeVTK(const char *fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
3119 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3120 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3121 MEDCouplingFieldDouble *deepCpy() const;
3122 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3123 MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
3124 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3125 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3126 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3127 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3128 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3129 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3130 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3131 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3132 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3133 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3134 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3135 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3136 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3137 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3138 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3139 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3140 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3141 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3142 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3143 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3144 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3145 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3146 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3147 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3148 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3149 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3150 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3151 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3152 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3153 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3154 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3155 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3156 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3157 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3158 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3159 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3160 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3161 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3162 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3163 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3164 void fillFromAnalytic(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3165 void fillFromAnalytic2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3166 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
3167 void applyFunc(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3168 void applyFunc2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3169 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
3170 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3171 void applyFunc(const char *func) throw(INTERP_KERNEL::Exception);
3172 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
3173 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
3174 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3175 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3176 double getMinValue() const throw(INTERP_KERNEL::Exception);
3177 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3178 double norm2() const throw(INTERP_KERNEL::Exception);
3179 double normMax() const throw(INTERP_KERNEL::Exception);
3180 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3181 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3182 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3183 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3184 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3185 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3186 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3187 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3188 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3189 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3190 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3191 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3192 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3193 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3194 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3195 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3196 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3197 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3198 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3199 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3200 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3201 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3203 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3205 return MEDCouplingFieldDouble::New(type,td);
3208 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3210 return MEDCouplingFieldDouble::New(ft,td);
3213 std::string __str__() const throw(INTERP_KERNEL::Exception)
3215 return self->simpleRepr();
3218 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3220 std::ostringstream oss;
3221 self->reprQuickOverview(oss);
3225 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3227 DataArrayDouble *ret=self->getArray();
3233 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3235 std::vector<DataArrayDouble *> arrs=self->getArrays();
3236 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3240 PyObject *ret=PyTuple_New(sz);
3241 for(int i=0;i<sz;i++)
3244 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3246 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3251 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3253 std::vector<const DataArrayDouble *> tmp;
3254 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3256 std::vector<DataArrayDouble *> arrs(sz);
3257 for(int i=0;i<sz;i++)
3258 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3259 self->setArrays(arrs);
3262 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3264 DataArrayDouble *ret=self->getEndArray();
3270 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3274 DataArrayDoubleTuple *aa;
3275 std::vector<double> bb;
3277 const MEDCouplingMesh *mesh=self->getMesh();
3279 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3280 int spaceDim=mesh->getSpaceDimension();
3281 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3282 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3284 int sz=self->getNumberOfComponents();
3285 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3286 self->getValueOn(spaceLoc,res);
3287 return convertDblArrToPyList(res,sz);
3290 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3292 int sz=self->getNumberOfComponents();
3293 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3294 self->getValueOnPos(i,j,k,res);
3295 return convertDblArrToPyList(res,sz);
3298 DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
3300 const MEDCouplingMesh *mesh(self->getMesh());
3302 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3305 double v0; ParaMEDMEM::DataArrayDouble *v1(0); ParaMEDMEM::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
3306 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
3307 mesh->getSpaceDimension(),true,nbPts);
3308 return self->getValueOnMulti(inp,nbPts);
3311 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3315 DataArrayDoubleTuple *aa;
3316 std::vector<double> bb;
3318 const MEDCouplingMesh *mesh=self->getMesh();
3320 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3321 int spaceDim=mesh->getSpaceDimension();
3322 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3323 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3326 int sz=self->getNumberOfComponents();
3327 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3328 self->getValueOn(spaceLoc,time,res);
3329 return convertDblArrToPyList(res,sz);
3332 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3334 if(self->getArray()!=0)
3335 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3338 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3339 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3340 self->setArray(arr);
3344 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3347 double tmp0=self->getTime(tmp1,tmp2);
3348 PyObject *res = PyList_New(3);
3349 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3350 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3351 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3355 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3358 double tmp0=self->getStartTime(tmp1,tmp2);
3359 PyObject *res = PyList_New(3);
3360 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3361 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3362 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3366 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3369 double tmp0=self->getEndTime(tmp1,tmp2);
3370 PyObject *res = PyList_New(3);
3371 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3372 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3373 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3376 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3378 int sz=self->getNumberOfComponents();
3379 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3380 self->accumulate(tmp);
3381 return convertDblArrToPyList(tmp,sz);
3383 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3385 int sz=self->getNumberOfComponents();
3386 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3387 self->integral(isWAbs,tmp);
3388 return convertDblArrToPyList(tmp,sz);
3390 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3392 int sz=self->getNumberOfComponents();
3393 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3394 self->getWeightedAverageValue(tmp,isWAbs);
3395 return convertDblArrToPyList(tmp,sz);
3397 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3399 int sz=self->getNumberOfComponents();
3400 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3402 return convertDblArrToPyList(tmp,sz);
3404 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3406 int sz=self->getNumberOfComponents();
3407 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3409 return convertDblArrToPyList(tmp,sz);
3411 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3413 int szArr,sw,iTypppArr;
3414 std::vector<int> stdvecTyyppArr;
3415 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3416 self->renumberCells(tmp,check);
3419 void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3421 int szArr,sw,iTypppArr;
3422 std::vector<int> stdvecTyyppArr;
3423 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3424 self->renumberCellsWithoutMesh(tmp,check);
3427 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3429 int szArr,sw,iTypppArr;
3430 std::vector<int> stdvecTyyppArr;
3431 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3432 self->renumberNodes(tmp,eps);
3435 void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3437 int szArr,sw,iTypppArr;
3438 std::vector<int> stdvecTyyppArr;
3439 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3440 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
3443 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3447 std::vector<int> multiVal;
3448 std::pair<int, std::pair<int,int> > slic;
3449 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3450 const MEDCouplingMesh *mesh=self->getMesh();
3452 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3453 int nbc=mesh->getNumberOfCells();
3454 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3461 std::ostringstream oss;
3462 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3463 throw INTERP_KERNEL::Exception(oss.str().c_str());
3466 return self->buildSubPart(&singleVal,&singleVal+1);
3471 int tmp=nbc+singleVal;
3472 return self->buildSubPart(&tmp,&tmp+1);
3476 std::ostringstream oss;
3477 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3478 throw INTERP_KERNEL::Exception(oss.str().c_str());
3484 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3488 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3493 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3494 daIntTyypp->checkAllocated();
3495 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3498 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3502 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3504 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";
3505 if(PyTuple_Check(li))
3507 Py_ssize_t sz=PyTuple_Size(li);
3509 throw INTERP_KERNEL::Exception(msg);
3510 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3513 std::vector<int> multiVal;
3514 std::pair<int, std::pair<int,int> > slic;
3515 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3516 if(!self->getArray())
3517 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3519 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3520 catch(INTERP_KERNEL::Exception& e)
3521 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3522 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3523 DataArrayDouble *ret0Arr=ret0->getArray();
3525 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3530 std::vector<int> v2(1,singleVal);
3531 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3532 ret0->setArray(aarr);
3537 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3538 ret0->setArray(aarr);
3543 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3544 std::vector<int> v2(nbOfComp);
3545 for(int i=0;i<nbOfComp;i++)
3546 v2[i]=slic.first+i*slic.second.second;
3547 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3548 ret0->setArray(aarr);
3552 throw INTERP_KERNEL::Exception(msg);
3557 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3560 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3563 double r1=self->getMaxValue2(tmp);
3564 PyObject *ret=PyTuple_New(2);
3565 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3566 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3570 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3573 double r1=self->getMinValue2(tmp);
3574 PyObject *ret=PyTuple_New(2);
3575 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3576 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3580 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3582 std::vector<int> tmp;
3583 convertPyToNewIntArr3(li,tmp);
3584 return self->keepSelectedComponents(tmp);
3587 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3589 std::vector<int> tmp;
3590 convertPyToNewIntArr3(li,tmp);
3591 self->setSelectedComponents(f,tmp);
3594 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3597 DataArrayDouble *a,*a2;
3598 DataArrayDoubleTuple *aa,*aa2;
3599 std::vector<double> bb,bb2;
3602 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
3603 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
3604 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3605 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3607 return self->extractSlice3D(orig,vect,eps);
3610 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3612 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
3615 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3617 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
3620 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3622 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.";
3623 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
3626 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3628 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3630 return (*self)-(*other);
3632 throw INTERP_KERNEL::Exception(msg);
3637 DataArrayDoubleTuple *aa;
3638 std::vector<double> bb;
3640 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3645 if(!self->getArray())
3646 throw INTERP_KERNEL::Exception(msg2);
3647 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3648 ret->applyLin(1.,-val);
3649 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3650 ret2->setArray(ret);
3655 if(!self->getArray())
3656 throw INTERP_KERNEL::Exception(msg2);
3657 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
3658 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3659 ret2->setArray(ret);
3664 if(!self->getArray())
3665 throw INTERP_KERNEL::Exception(msg2);
3666 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3667 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3668 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3669 ret2->setArray(ret);
3674 if(!self->getArray())
3675 throw INTERP_KERNEL::Exception(msg2);
3676 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3677 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3678 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3679 ret2->setArray(ret);
3683 { throw INTERP_KERNEL::Exception(msg); }
3687 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3689 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
3692 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3694 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
3697 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3699 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
3702 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3704 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.";
3705 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
3708 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3710 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3712 return (*self)/(*other);
3714 throw INTERP_KERNEL::Exception(msg);
3719 DataArrayDoubleTuple *aa;
3720 std::vector<double> bb;
3722 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3728 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
3729 if(!self->getArray())
3730 throw INTERP_KERNEL::Exception(msg2);
3731 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3732 ret->applyLin(1./val,0);
3733 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3734 ret2->setArray(ret);
3739 if(!self->getArray())
3740 throw INTERP_KERNEL::Exception(msg2);
3741 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
3742 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3743 ret2->setArray(ret);
3748 if(!self->getArray())
3749 throw INTERP_KERNEL::Exception(msg2);
3750 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3751 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3752 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3753 ret2->setArray(ret);
3758 if(!self->getArray())
3759 throw INTERP_KERNEL::Exception(msg2);
3760 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3761 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3762 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3763 ret2->setArray(ret);
3767 { throw INTERP_KERNEL::Exception(msg); }
3771 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3773 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
3776 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3778 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.";
3779 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
3782 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3784 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3786 return (*self)^(*other);
3788 throw INTERP_KERNEL::Exception(msg);
3793 DataArrayDoubleTuple *aa;
3794 std::vector<double> bb;
3796 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3801 if(!self->getArray())
3802 throw INTERP_KERNEL::Exception(msg2);
3803 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3805 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3806 ret2->setArray(ret);
3811 if(!self->getArray())
3812 throw INTERP_KERNEL::Exception(msg2);
3813 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
3814 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3815 ret2->setArray(ret);
3820 if(!self->getArray())
3821 throw INTERP_KERNEL::Exception(msg2);
3822 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3823 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3824 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3825 ret2->setArray(ret);
3830 if(!self->getArray())
3831 throw INTERP_KERNEL::Exception(msg2);
3832 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3833 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3834 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3835 ret2->setArray(ret);
3839 { throw INTERP_KERNEL::Exception(msg); }
3843 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
3845 return self->negate();
3848 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3850 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.";
3851 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
3854 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3856 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3860 Py_XINCREF(trueSelf);
3864 throw INTERP_KERNEL::Exception(msg);
3869 DataArrayDoubleTuple *aa;
3870 std::vector<double> bb;
3872 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3877 if(!self->getArray())
3878 throw INTERP_KERNEL::Exception(msg2);
3879 self->getArray()->applyLin(1.,val);
3880 Py_XINCREF(trueSelf);
3885 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3888 Py_XINCREF(trueSelf);
3893 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3894 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3895 ret2->setArray(aaa);
3897 Py_XINCREF(trueSelf);
3902 if(!self->getArray())
3903 throw INTERP_KERNEL::Exception(msg2);
3904 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3905 self->getArray()->addEqual(aaa);
3906 Py_XINCREF(trueSelf);
3910 { throw INTERP_KERNEL::Exception(msg); }
3914 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3916 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.";
3917 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
3920 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3922 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3926 Py_XINCREF(trueSelf);
3930 throw INTERP_KERNEL::Exception(msg);
3935 DataArrayDoubleTuple *aa;
3936 std::vector<double> bb;
3938 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3943 if(!self->getArray())
3944 throw INTERP_KERNEL::Exception(msg2);
3945 self->getArray()->applyLin(1.,-val);
3946 Py_XINCREF(trueSelf);
3951 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3954 Py_XINCREF(trueSelf);
3959 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3960 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3961 ret2->setArray(aaa);
3963 Py_XINCREF(trueSelf);
3968 if(!self->getArray())
3969 throw INTERP_KERNEL::Exception(msg2);
3970 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3971 self->getArray()->substractEqual(aaa);
3972 Py_XINCREF(trueSelf);
3976 { throw INTERP_KERNEL::Exception(msg); }
3980 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3982 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.";
3983 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
3986 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3988 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3992 Py_XINCREF(trueSelf);
3996 throw INTERP_KERNEL::Exception(msg);
4001 DataArrayDoubleTuple *aa;
4002 std::vector<double> bb;
4004 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4009 if(!self->getArray())
4010 throw INTERP_KERNEL::Exception(msg2);
4011 self->getArray()->applyLin(val,0);
4012 Py_XINCREF(trueSelf);
4017 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4020 Py_XINCREF(trueSelf);
4025 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4026 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4027 ret2->setArray(aaa);
4029 Py_XINCREF(trueSelf);
4034 if(!self->getArray())
4035 throw INTERP_KERNEL::Exception(msg2);
4036 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4037 self->getArray()->multiplyEqual(aaa);
4038 Py_XINCREF(trueSelf);
4042 { throw INTERP_KERNEL::Exception(msg); }
4046 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4048 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.";
4049 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4052 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4054 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4058 Py_XINCREF(trueSelf);
4062 throw INTERP_KERNEL::Exception(msg);
4067 DataArrayDoubleTuple *aa;
4068 std::vector<double> bb;
4070 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4076 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4077 if(!self->getArray())
4078 throw INTERP_KERNEL::Exception(msg2);
4079 self->getArray()->applyLin(1./val,0);
4080 Py_XINCREF(trueSelf);
4085 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4088 Py_XINCREF(trueSelf);
4093 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4094 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4095 ret2->setArray(aaa);
4097 Py_XINCREF(trueSelf);
4102 if(!self->getArray())
4103 throw INTERP_KERNEL::Exception(msg2);
4104 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4105 self->getArray()->divideEqual(aaa);
4106 Py_XINCREF(trueSelf);
4110 { throw INTERP_KERNEL::Exception(msg); }
4114 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4116 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.";
4117 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4120 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4122 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4126 Py_XINCREF(trueSelf);
4130 throw INTERP_KERNEL::Exception(msg);
4135 DataArrayDoubleTuple *aa;
4136 std::vector<double> bb;
4138 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4143 if(!self->getArray())
4144 throw INTERP_KERNEL::Exception(msg2);
4145 self->getArray()->applyPow(val);
4146 Py_XINCREF(trueSelf);
4151 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4154 Py_XINCREF(trueSelf);
4159 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4160 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4161 ret2->setArray(aaa);
4163 Py_XINCREF(trueSelf);
4168 if(!self->getArray())
4169 throw INTERP_KERNEL::Exception(msg2);
4170 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4171 self->getArray()->powEqual(aaa);
4172 Py_XINCREF(trueSelf);
4176 { throw INTERP_KERNEL::Exception(msg); }
4180 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4182 std::vector<const MEDCouplingFieldDouble *> tmp;
4183 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4184 return MEDCouplingFieldDouble::MergeFields(tmp);
4187 static void WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
4189 std::vector<const MEDCouplingFieldDouble *> tmp;
4190 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4191 MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4196 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4199 int getNumberOfFields() const;
4200 MEDCouplingMultiFields *deepCpy() const;
4201 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4202 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4203 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4204 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4205 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4208 std::string __str__() const throw(INTERP_KERNEL::Exception)
4210 return self->simpleRepr();
4212 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4214 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4215 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4217 std::vector<MEDCouplingFieldDouble *> fs(sz);
4218 for(int i=0;i<sz;i++)
4219 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4220 return MEDCouplingMultiFields::New(fs);
4222 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4224 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4225 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4227 std::vector<MEDCouplingFieldDouble *> fs(sz);
4228 for(int i=0;i<sz;i++)
4229 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4230 return MEDCouplingMultiFields::New(fs);
4232 PyObject *getFields() const
4234 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4235 int sz=fields.size();
4236 PyObject *res = PyList_New(sz);
4237 for(int i=0;i<sz;i++)
4241 fields[i]->incrRef();
4242 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4246 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4251 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4253 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4257 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4260 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4262 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4264 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4266 PyObject *res = PyList_New(sz);
4267 for(int i=0;i<sz;i++)
4272 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4276 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4281 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4283 std::vector<int> refs;
4284 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4286 PyObject *res = PyList_New(sz);
4287 for(int i=0;i<sz;i++)
4292 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4296 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4300 PyObject *ret=PyTuple_New(2);
4301 PyTuple_SetItem(ret,0,res);
4302 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4305 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4307 std::vector<DataArrayDouble *> ms=self->getArrays();
4309 PyObject *res = PyList_New(sz);
4310 for(int i=0;i<sz;i++)
4315 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4319 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4324 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4326 std::vector< std::vector<int> > refs;
4327 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4329 PyObject *res = PyList_New(sz);
4330 PyObject *res2 = PyList_New(sz);
4331 for(int i=0;i<sz;i++)
4336 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4340 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4342 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4345 PyObject *ret=PyTuple_New(2);
4346 PyTuple_SetItem(ret,0,res);
4347 PyTuple_SetItem(ret,1,res2);
4353 class MEDCouplingDefinitionTime
4356 MEDCouplingDefinitionTime();
4357 void assign(const MEDCouplingDefinitionTime& other);
4358 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4359 double getTimeResolution() const;
4360 std::vector<double> getHotSpotsTime() const;
4363 std::string __str__() const throw(INTERP_KERNEL::Exception)
4365 std::ostringstream oss;
4366 self->appendRepr(oss);
4370 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4372 int meshId,arrId,arrIdInField,fieldId;
4373 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4374 PyObject *res=PyList_New(4);
4375 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4376 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4377 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4378 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4382 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4384 int meshId,arrId,arrIdInField,fieldId;
4385 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4386 PyObject *res=PyList_New(4);
4387 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4388 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4389 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4390 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4396 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4399 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4400 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4404 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4406 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4407 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4409 std::vector<MEDCouplingFieldDouble *> fs(sz);
4410 for(int i=0;i<sz;i++)
4411 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4412 return MEDCouplingFieldOverTime::New(fs);
4414 std::string __str__() const throw(INTERP_KERNEL::Exception)
4416 return self->simpleRepr();
4418 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4420 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4421 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4423 std::vector<MEDCouplingFieldDouble *> fs(sz);
4424 for(int i=0;i<sz;i++)
4425 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4426 return MEDCouplingFieldOverTime::New(fs);
4434 __filename=os.environ.get('PYTHONSTARTUP')
4435 if __filename and os.path.isfile(__filename):
4436 execfile(__filename)