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::MEDCouplingUMeshCellByTypeEntry::__iter__;
271 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
272 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::New;
273 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::getNodalConnectivity;
274 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
275 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::New;
276 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
277 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::computeDualMesh;
278 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
279 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::sortHexa8EachOther;
280 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
281 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
282 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::New;
283 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
284 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
285 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
286 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
287 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
288 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
289 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::buildStructuredSubPart;
290 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTUnstructured;
291 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
292 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
293 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
294 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
295 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
296 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
297 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
298 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
299 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
300 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
301 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
303 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
304 %feature("unref") MEDCouplingMesh "$this->decrRef();"
305 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
306 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
307 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
308 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
309 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
310 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
311 %feature("unref") MEDCouplingField "$this->decrRef();"
312 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
313 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
314 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
315 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
316 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
317 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
318 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
319 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
320 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
322 %rename(assign) *::operator=;
323 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
324 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
325 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
326 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
330 %rename (InterpKernelException) INTERP_KERNEL::Exception;
332 %include "MEDCouplingRefCountObject.i"
333 %include "MEDCouplingMemArray.i"
351 CONST_ON_TIME_INTERVAL = 7
352 } TypeOfTimeDiscretization;
360 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
361 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11
362 } MEDCouplingMeshType;
365 class DataArrayDouble;
366 class MEDCouplingUMesh;
367 class MEDCouplingFieldDouble;
369 %extend RefCountObject
371 std::string getHiddenCppPointer() const
373 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
378 %extend MEDCouplingGaussLocalization
380 std::string __str__() const throw(INTERP_KERNEL::Exception)
382 return self->getStringRepr();
385 std::string __repr__() const throw(INTERP_KERNEL::Exception)
387 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
388 oss << self->getStringRepr();
395 class MEDCouplingMesh : public RefCountObject, public TimeLabel
398 void setName(const char *name);
399 std::string getName() const;
400 void setDescription(const char *descr);
401 std::string getDescription() const;
402 void setTime(double val, int iteration, int order);
403 void setTimeUnit(const char *unit);
404 const char *getTimeUnit() const;
405 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
406 bool isStructured() const throw(INTERP_KERNEL::Exception);
407 virtual MEDCouplingMesh *deepCpy() const;
408 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
409 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
410 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
411 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
412 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
413 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
414 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
415 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
416 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
417 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
418 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
419 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
420 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
421 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
422 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
423 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
424 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
425 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
426 virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
427 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
428 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
429 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
430 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
431 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
432 void writeVTK(const char *fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
434 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
435 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
436 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
437 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
438 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
439 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
440 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
441 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
442 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
443 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
444 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
445 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
446 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
447 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
448 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
449 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
450 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
453 std::string __str__() const throw(INTERP_KERNEL::Exception)
455 return self->simpleRepr();
458 PyObject *getTime() throw(INTERP_KERNEL::Exception)
461 double tmp0=self->getTime(tmp1,tmp2);
462 PyObject *res = PyList_New(3);
463 PyList_SetItem(res,0,SWIG_From_double(tmp0));
464 PyList_SetItem(res,1,SWIG_From_int(tmp1));
465 PyList_SetItem(res,2,SWIG_From_int(tmp2));
469 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
473 DataArrayDoubleTuple *aa;
474 std::vector<double> bb;
476 int spaceDim=self->getSpaceDimension();
477 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
478 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
479 return self->getCellContainingPoint(pos,eps);
482 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
486 DataArrayDoubleTuple *aa;
487 std::vector<double> bb;
489 int spaceDim=self->getSpaceDimension();
490 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
491 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
492 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
493 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
494 PyObject *ret=PyTuple_New(2);
495 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
496 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
500 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
502 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
503 int spaceDim=self->getSpaceDimension();
505 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
506 if (!SWIG_IsOK(res1))
509 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
510 int nbOfPoints=size/spaceDim;
513 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
515 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
519 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
521 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
522 da2->checkAllocated();
523 int size=da2->getNumberOfTuples();
524 int nbOfCompo=da2->getNumberOfComponents();
525 if(nbOfCompo!=spaceDim)
527 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
529 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
531 PyObject *ret=PyTuple_New(2);
532 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
533 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
537 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
541 DataArrayDoubleTuple *aa;
542 std::vector<double> bb;
544 int spaceDim=self->getSpaceDimension();
545 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
546 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
547 std::vector<int> elts;
548 self->getCellsContainingPoint(pos,eps,elts);
549 DataArrayInt *ret=DataArrayInt::New();
550 ret->alloc((int)elts.size(),1);
551 std::copy(elts.begin(),elts.end(),ret->getPointer());
552 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
555 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
558 int v0; std::vector<int> v1;
559 const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
560 self->renumberCells(ids,check);
563 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
565 DataArrayInt *cellCor, *nodeCor;
566 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
567 PyObject *res = PyList_New(2);
568 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
569 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
573 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
575 DataArrayInt *cellCor=0,*nodeCor=0;
576 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
577 PyObject *res = PyList_New(2);
578 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
579 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
583 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
585 DataArrayInt *cellCor=0;
586 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
590 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
593 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
594 if (!SWIG_IsOK(res1))
597 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
598 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
602 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
604 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
605 da2->checkAllocated();
606 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
609 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
611 std::vector<int> conn;
612 self->getNodeIdsOfCell(cellId,conn);
613 return convertIntArrToPyList2(conn);
616 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
618 std::vector<double> coo;
619 self->getCoordinatesOfNode(nodeId,coo);
620 return convertDblArrToPyList2(coo);
623 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
627 DataArrayDoubleTuple *aa;
628 std::vector<double> bb;
630 int spaceDim=self->getSpaceDimension();
631 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
632 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
633 self->scale(pointPtr,factor);
636 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
638 int spaceDim=self->getSpaceDimension();
639 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
640 self->getBoundingBox(tmp);
641 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
645 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
648 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
649 PyObject *ret=PyTuple_New(2);
650 PyObject *ret0Py=ret0?Py_True:Py_False;
652 PyTuple_SetItem(ret,0,ret0Py);
653 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
657 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
659 int szArr,sw,iTypppArr;
660 std::vector<int> stdvecTyyppArr;
661 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
662 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
663 if(sw==3)//DataArrayInt
665 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
666 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
667 std::string name=argpt->getName();
669 ret->setName(name.c_str());
671 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
674 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
676 int szArr,sw,iTypppArr;
677 std::vector<int> stdvecTyyppArr;
679 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
680 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
681 if(sw==3)//DataArrayInt
683 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
684 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
685 std::string name=argpt->getName();
687 ret->setName(name.c_str());
690 PyObject *res = PyList_New(2);
691 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
692 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
693 PyList_SetItem(res,0,obj0);
694 PyList_SetItem(res,1,obj1);
698 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
702 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
703 PyObject *res = PyTuple_New(2);
704 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
707 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
709 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
710 PyTuple_SetItem(res,0,obj0);
711 PyTuple_SetItem(res,1,obj1);
715 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
717 std::vector<int> vals=self->getDistributionOfTypes();
719 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
720 PyObject *ret=PyList_New((int)vals.size()/3);
721 for(int j=0;j<(int)vals.size()/3;j++)
723 PyObject *ret1=PyList_New(3);
724 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
725 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
726 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
727 PyList_SetItem(ret,j,ret1);
732 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
734 std::vector<int> code;
735 std::vector<const DataArrayInt *> idsPerType;
736 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
737 convertPyToNewIntArr4(li,1,3,code);
738 return self->checkTypeConsistencyAndContig(code,idsPerType);
741 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
743 std::vector<int> code;
744 std::vector<DataArrayInt *> idsInPflPerType;
745 std::vector<DataArrayInt *> idsPerType;
746 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
747 PyObject *ret=PyTuple_New(3);
750 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
751 PyObject *ret0=PyList_New((int)code.size()/3);
752 for(int j=0;j<(int)code.size()/3;j++)
754 PyObject *ret00=PyList_New(3);
755 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
756 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
757 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
758 PyList_SetItem(ret0,j,ret00);
760 PyTuple_SetItem(ret,0,ret0);
762 PyObject *ret1=PyList_New(idsInPflPerType.size());
763 for(std::size_t j=0;j<idsInPflPerType.size();j++)
764 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
765 PyTuple_SetItem(ret,1,ret1);
766 int n=idsPerType.size();
767 PyObject *ret2=PyList_New(n);
769 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
770 PyTuple_SetItem(ret,2,ret2);
774 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
778 DataArrayDoubleTuple *aa;
779 std::vector<double> bb;
781 int spaceDim=self->getSpaceDimension();
782 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
783 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
784 self->translate(vectorPtr);
787 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
789 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
792 DataArrayDoubleTuple *aa;
793 std::vector<double> bb;
795 int spaceDim=self->getSpaceDimension();
796 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
797 self->rotate(centerPtr,0,alpha);
800 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
802 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
804 DataArrayDouble *a,*a2;
805 DataArrayDoubleTuple *aa,*aa2;
806 std::vector<double> bb,bb2;
808 int spaceDim=self->getSpaceDimension();
809 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
810 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
811 self->rotate(centerPtr,vectorPtr,alpha);
814 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
816 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
817 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
818 PyObject *res=PyList_New(result.size());
819 for(int i=0;iL!=result.end(); i++, iL++)
820 PyList_SetItem(res,i,PyInt_FromLong(*iL));
824 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
826 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
827 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
828 return MEDCouplingMesh::MergeMeshes(tmp);
834 //== MEDCouplingMesh End
836 %include "NormalizedGeometricTypes"
837 %include "MEDCouplingNatureOfFieldEnum"
841 class MEDCouplingNatureOfField
844 static const char *GetRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception);
845 static std::string GetReprNoThrow(NatureOfField nat);
846 static std::string GetAllPossibilitiesStr();
850 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
851 // include "MEDCouplingTimeDiscretization.i"
855 class MEDCouplingGaussLocalization
858 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
859 const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
860 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
861 INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
862 void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
863 int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
864 int getDimension() const throw(INTERP_KERNEL::Exception);
865 int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
866 std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
867 void checkCoherency() const throw(INTERP_KERNEL::Exception);
868 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception);
870 const std::vector<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
871 double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
872 const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
873 double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
874 const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
875 double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
876 void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
877 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
878 void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
879 void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
880 void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
881 void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
883 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
887 %include "MEDCouplingFieldDiscretization.i"
889 //== MEDCouplingPointSet
893 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
896 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
897 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
898 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
899 void zipCoords() throw(INTERP_KERNEL::Exception);
900 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
901 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
902 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
903 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
904 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
905 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
906 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
907 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
908 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
909 static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception);
910 virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
911 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
912 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
913 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
914 virtual DataArrayInt *findBoundaryNodes() const;
915 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
916 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
917 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
918 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
919 virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
920 virtual DataArrayDouble *getBoundingBoxForBBTree() const throw(INTERP_KERNEL::Exception);
923 std::string __str__() const throw(INTERP_KERNEL::Exception)
925 return self->simpleRepr();
928 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
931 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
932 PyObject *res = PyList_New(2);
933 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
934 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
938 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
940 DataArrayInt *comm, *commIndex;
941 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
942 PyObject *res = PyList_New(2);
943 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
944 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
948 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
950 DataArrayDouble *ret1=self->getCoords();
953 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
956 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
958 int szArr,sw,iTypppArr;
959 std::vector<int> stdvecTyyppArr;
960 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
961 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
962 if(sw==3)//DataArrayInt
964 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
965 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
966 std::string name=argpt->getName();
968 ret->setName(name.c_str());
970 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
973 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
975 int szArr,sw,iTypppArr;
976 std::vector<int> stdvecTyyppArr;
977 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
978 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
979 if(sw==3)//DataArrayInt
981 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
982 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
983 std::string name=argpt->getName();
985 ret->setName(name.c_str());
987 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
990 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
992 int szArr,sw,iTypppArr;
993 std::vector<int> stdvecTyyppArr;
994 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
995 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
996 if(sw==3)//DataArrayInt
998 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
999 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1000 std::string name=argpt->getName();
1002 ret->setName(name.c_str());
1004 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1007 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1009 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1010 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1013 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1015 int szArr,sw,iTypppArr;
1016 std::vector<int> stdvecTyyppArr;
1017 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1018 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1019 if(sw==3)//DataArrayInt
1021 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1022 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1023 std::string name=argpt->getName();
1025 ret->setName(name.c_str());
1027 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1030 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1032 int szArr,sw,iTypppArr;
1033 std::vector<int> stdvecTyyppArr;
1034 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1035 self->renumberNodes(tmp,newNbOfNodes);
1038 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1040 int szArr,sw,iTypppArr;
1041 std::vector<int> stdvecTyyppArr;
1042 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1043 self->renumberNodes2(tmp,newNbOfNodes);
1046 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1048 int spaceDim=self->getSpaceDimension();
1050 DataArrayDouble *a,*a2;
1051 DataArrayDoubleTuple *aa,*aa2;
1052 std::vector<double> bb,bb2;
1054 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1055 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1056 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1057 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1058 std::vector<int> nodes;
1059 self->findNodesOnLine(p,v,eps,nodes);
1060 DataArrayInt *ret=DataArrayInt::New();
1061 ret->alloc((int)nodes.size(),1);
1062 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1063 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1065 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1067 int spaceDim=self->getSpaceDimension();
1069 DataArrayDouble *a,*a2;
1070 DataArrayDoubleTuple *aa,*aa2;
1071 std::vector<double> bb,bb2;
1073 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1074 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1075 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1076 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1077 std::vector<int> nodes;
1078 self->findNodesOnPlane(p,v,eps,nodes);
1079 DataArrayInt *ret=DataArrayInt::New();
1080 ret->alloc((int)nodes.size(),1);
1081 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1082 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1085 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1089 DataArrayDoubleTuple *aa;
1090 std::vector<double> bb;
1092 int spaceDim=self->getSpaceDimension();
1093 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1094 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1095 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1096 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1099 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1101 DataArrayInt *c=0,*cI=0;
1105 DataArrayDoubleTuple *aa;
1106 std::vector<double> bb;
1108 int spaceDim=self->getSpaceDimension();
1109 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1110 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1111 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1112 PyObject *ret=PyTuple_New(2);
1113 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1114 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1118 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1120 DataArrayInt *c=0,*cI=0;
1121 int spaceDim=self->getSpaceDimension();
1124 DataArrayDoubleTuple *aa;
1125 std::vector<double> bb;
1128 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1129 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1131 PyObject *ret=PyTuple_New(2);
1132 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1133 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1137 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1141 DataArrayDoubleTuple *aa;
1142 std::vector<double> bb;
1144 int spaceDim=self->getSpaceDimension();
1145 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1146 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1148 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1149 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1152 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1156 std::vector<int> multiVal;
1157 std::pair<int, std::pair<int,int> > slic;
1158 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1159 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1163 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1165 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1167 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1169 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1173 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
1175 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
1176 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
1177 self->getReverseNodalConnectivity(d0,d1);
1178 PyObject *ret=PyTuple_New(2);
1179 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1180 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1184 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1186 DataArrayInt *v0=0,*v1=0;
1187 self->findCommonCells(compType,startCellId,v0,v1);
1188 PyObject *res = PyList_New(2);
1189 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1190 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1195 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1198 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1199 if (!SWIG_IsOK(res1))
1202 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1203 self->renumberNodesInConn(tmp);
1207 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1209 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1210 da2->checkAllocated();
1211 self->renumberNodesInConn(da2->getConstPointer());
1215 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1218 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1219 PyObject *ret=PyTuple_New(2);
1220 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1221 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1225 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1227 DataArrayInt *ret=0;
1229 int szArr,sw,iTypppArr;
1230 std::vector<int> stdvecTyyppArr;
1231 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1232 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1236 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1240 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1241 PyObject *res = PyList_New(3);
1242 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1243 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1244 PyList_SetItem(res,2,SWIG_From_int(ret2));
1248 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1252 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1253 PyObject *res = PyList_New(3);
1254 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1255 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1256 PyList_SetItem(res,2,SWIG_From_int(ret2));
1260 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1263 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1264 if (!SWIG_IsOK(res1))
1267 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1268 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1272 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1274 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1275 da2->checkAllocated();
1276 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1280 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1284 std::vector<int> multiVal;
1285 std::pair<int, std::pair<int,int> > slic;
1286 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1287 int nbc=self->getNumberOfCells();
1288 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1295 std::ostringstream oss;
1296 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1297 throw INTERP_KERNEL::Exception(oss.str().c_str());
1300 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1305 int tmp=nbc+singleVal;
1306 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1310 std::ostringstream oss;
1311 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1312 throw INTERP_KERNEL::Exception(oss.str().c_str());
1318 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1322 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1327 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1328 daIntTyypp->checkAllocated();
1329 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1332 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1336 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1339 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1340 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1341 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1342 for(int i=0;i<sz;i++)
1343 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1346 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1349 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1351 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1352 std::vector<double> val3;
1353 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1354 "Rotate2DAlg",2,true,nbNodes);
1356 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1357 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1360 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1363 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1364 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1365 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1366 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1367 for(int i=0;i<sz;i++)
1368 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1371 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1374 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1376 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1377 std::vector<double> val3;
1378 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1379 "Rotate3DAlg",3,true,nbNodes);
1381 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1382 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1383 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1388 //== MEDCouplingPointSet End
1390 class MEDCouplingUMeshCell
1393 INTERP_KERNEL::NormalizedCellType getType() const;
1396 std::string __str__() const throw(INTERP_KERNEL::Exception)
1398 return self->repr();
1401 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1404 const int *r=self->getAllConn(ret2);
1405 PyObject *ret=PyTuple_New(ret2);
1406 for(int i=0;i<ret2;i++)
1407 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1413 class MEDCouplingUMeshCellIterator
1420 MEDCouplingUMeshCell *ret=self->nextt();
1422 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1425 PyErr_SetString(PyExc_StopIteration,"No more data.");
1432 class MEDCouplingUMeshCellByTypeIterator
1435 ~MEDCouplingUMeshCellByTypeIterator();
1440 MEDCouplingUMeshCellEntry *ret=self->nextt();
1442 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1445 PyErr_SetString(PyExc_StopIteration,"No more data.");
1452 class MEDCouplingUMeshCellByTypeEntry
1455 ~MEDCouplingUMeshCellByTypeEntry();
1458 MEDCouplingUMeshCellByTypeIterator *__iter__()
1460 return self->iterator();
1465 class MEDCouplingUMeshCellEntry
1468 INTERP_KERNEL::NormalizedCellType getType() const;
1469 int getNumberOfElems() const;
1472 MEDCouplingUMeshCellIterator *__iter__()
1474 return self->iterator();
1479 //== MEDCouplingUMesh
1481 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1484 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1485 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1486 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1487 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1488 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1489 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1490 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1491 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1492 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1493 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1494 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1495 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1496 void computeTypes() throw(INTERP_KERNEL::Exception);
1497 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1498 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1500 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1501 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1502 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1503 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1504 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1505 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1506 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1507 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1508 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1509 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1510 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1511 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1512 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1513 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1514 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1515 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1516 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1517 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1518 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1519 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1520 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1521 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1522 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1523 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1524 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1525 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1526 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1527 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1528 DataArrayDouble *computePlaneEquationOf3DFaces() const throw(INTERP_KERNEL::Exception);
1529 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1530 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1531 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1532 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1533 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1534 DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1535 DataArrayInt *buildUnionOf2DMesh() const throw(INTERP_KERNEL::Exception);
1536 DataArrayInt *buildUnionOf3DMesh() const throw(INTERP_KERNEL::Exception);
1537 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1538 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1539 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1540 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1541 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1543 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1545 return MEDCouplingUMesh::New();
1548 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1550 return MEDCouplingUMesh::New(meshName,meshDim);
1553 std::string __str__() const throw(INTERP_KERNEL::Exception)
1555 return self->simpleRepr();
1558 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1560 std::ostringstream oss;
1561 self->reprQuickOverview(oss);
1565 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1567 return self->cellIterator();
1570 PyObject *getAllGeoTypesSorted() const throw(INTERP_KERNEL::Exception)
1572 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
1573 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1574 PyObject *res=PyList_New(result.size());
1575 for(int i=0;iL!=result.end(); i++, iL++)
1576 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1580 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1584 std::vector<int> multiVal;
1585 std::pair<int, std::pair<int,int> > slic;
1586 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1587 int nbc=self->getNumberOfCells();
1588 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1595 std::ostringstream oss;
1596 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1597 throw INTERP_KERNEL::Exception(oss.str().c_str());
1601 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1608 int tmp=nbc+singleVal;
1609 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1614 std::ostringstream oss;
1615 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1616 throw INTERP_KERNEL::Exception(oss.str().c_str());
1622 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1628 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1629 daIntTyypp->checkAllocated();
1630 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1634 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1638 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1642 std::vector<int> multiVal;
1643 std::pair<int, std::pair<int,int> > slic;
1644 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1645 int nbc=self->getNumberOfCells();
1646 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1653 std::ostringstream oss;
1654 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1655 throw INTERP_KERNEL::Exception(oss.str().c_str());
1659 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1666 int tmp=nbc+singleVal;
1667 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1672 std::ostringstream oss;
1673 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1674 throw INTERP_KERNEL::Exception(oss.str().c_str());
1680 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1685 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1691 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1692 daIntTyypp->checkAllocated();
1693 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1697 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1701 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1703 int szArr,sw,iTypppArr;
1704 std::vector<int> stdvecTyyppArr;
1705 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1708 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1709 throw INTERP_KERNEL::Exception(oss.str().c_str());
1711 self->insertNextCell(type,size,tmp);
1714 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1716 int szArr,sw,iTypppArr;
1717 std::vector<int> stdvecTyyppArr;
1718 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1719 self->insertNextCell(type,szArr,tmp);
1722 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1724 DataArrayInt *ret=self->getNodalConnectivity();
1729 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1731 DataArrayInt *ret=self->getNodalConnectivityIndex();
1737 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1739 int szArr,sw,iTypppArr;
1740 std::vector<int> stdvecTyyppArr;
1741 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1742 int nbOfDepthPeelingPerformed=0;
1743 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1744 PyObject *res=PyTuple_New(2);
1745 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1746 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1750 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1752 DataArrayInt *v0=0,*v1=0;
1753 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1754 PyObject *res = PyList_New(2);
1755 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1756 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1760 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1764 DataArrayDoubleTuple *aa;
1765 std::vector<double> bb;
1767 int nbOfCompo=self->getSpaceDimension();
1768 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1771 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1772 PyObject *ret=PyTuple_New(2);
1773 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1774 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1778 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1780 DataArrayInt *ret1=0;
1781 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1782 PyObject *ret=PyTuple_New(2);
1783 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1784 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1788 PyObject *tetrahedrize(int policy) throw(INTERP_KERNEL::Exception)
1791 DataArrayInt *ret1(0);
1792 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
1793 PyObject *ret=PyTuple_New(3);
1794 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
1795 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1796 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
1800 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1802 std::vector<int> cells;
1803 self->checkButterflyCells(cells,eps);
1804 DataArrayInt *ret=DataArrayInt::New();
1805 ret->alloc((int)cells.size(),1);
1806 std::copy(cells.begin(),cells.end(),ret->getPointer());
1807 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1810 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1812 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1814 PyObject *ret = PyList_New(sz);
1815 for(int i=0;i<sz;i++)
1816 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1820 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1822 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1823 int sz=retCpp.size();
1824 PyObject *ret=PyList_New(sz);
1825 for(int i=0;i<sz;i++)
1826 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1830 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1833 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1834 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1835 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1838 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1841 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1842 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1846 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1849 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1850 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1854 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1856 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1857 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1858 PyObject *ret=PyTuple_New(3);
1859 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1860 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1861 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1865 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1867 DataArrayInt *tmp0=0,*tmp1=0;
1868 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1869 PyObject *ret=PyTuple_New(2);
1870 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1871 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1875 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1879 std::vector<int> multiVal;
1880 std::pair<int, std::pair<int,int> > slic;
1881 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1882 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1886 return self->duplicateNodes(&singleVal,&singleVal+1);
1888 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
1890 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
1892 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1896 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
1900 std::vector<int> multiVal;
1901 std::pair<int, std::pair<int,int> > slic;
1902 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1903 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1907 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
1909 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
1911 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
1913 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1917 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
1920 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1921 DataArrayInt *tmp0,*tmp1=0;
1922 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
1923 PyObject *ret=PyTuple_New(2);
1924 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1925 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1929 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const throw(INTERP_KERNEL::Exception)
1931 DataArrayInt *ret0=0,*ret1=0;
1932 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
1933 PyObject *ret=PyTuple_New(2);
1934 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1935 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1939 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1941 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1942 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1943 DataArrayInt *ret1=0,*ret2=0;
1944 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
1945 PyObject *ret=PyTuple_New(3);
1946 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1947 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1948 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1952 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1954 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1955 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1956 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
1957 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1960 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
1963 std::vector<const MEDCouplingUMesh *> meshes;
1964 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1965 std::vector<DataArrayInt *> corr;
1966 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
1968 PyObject *ret1=PyList_New(sz);
1969 for(int i=0;i<sz;i++)
1970 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1971 PyObject *ret=PyList_New(2);
1972 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1973 PyList_SetItem(ret,1,ret1);
1977 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1979 std::vector<MEDCouplingUMesh *> meshes;
1980 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1981 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
1984 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
1986 std::vector<MEDCouplingUMesh *> meshes;
1987 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1988 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
1991 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
1995 std::vector<int> multiVal;
1996 std::pair<int, std::pair<int,int> > slic;
1997 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1999 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2000 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2004 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2006 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2008 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2010 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2014 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2016 DataArrayInt *arrOut=0,*arrIndexOut=0;
2019 std::vector<int> multiVal;
2020 std::pair<int, std::pair<int,int> > slic;
2021 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2023 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2024 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2029 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2034 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2039 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2043 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2045 PyObject *ret=PyTuple_New(2);
2046 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2047 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2051 static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2053 DataArrayInt *arrOut=0,*arrIndexOut=0;
2054 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2055 PyObject *ret=PyTuple_New(2);
2056 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2057 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2061 static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2063 if(!PySlice_Check(slic))
2064 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !");
2065 Py_ssize_t strt=2,stp=2,step=2;
2066 PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
2068 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !");
2069 arrIndxIn->checkAllocated();
2070 if(arrIndxIn->getNumberOfComponents()!=1)
2071 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !");
2072 if(PySlice_GetIndices(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step)!=0)
2073 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !");
2074 DataArrayInt *arrOut=0,*arrIndexOut=0;
2075 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2076 PyObject *ret=PyTuple_New(2);
2077 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2078 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2082 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2083 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2084 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2086 DataArrayInt *arrOut=0,*arrIndexOut=0;
2089 std::vector<int> multiVal;
2090 std::pair<int, std::pair<int,int> > slic;
2091 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2093 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2094 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2099 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2104 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2109 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2113 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2115 PyObject *ret=PyTuple_New(2);
2116 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2117 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2121 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2122 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2126 std::vector<int> multiVal;
2127 std::pair<int, std::pair<int,int> > slic;
2128 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2130 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2131 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2136 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2141 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2146 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2150 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2154 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2158 DataArrayDoubleTuple *aa;
2159 std::vector<double> bb;
2161 int spaceDim=self->getSpaceDimension();
2162 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2163 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2165 std::vector<int> cells;
2166 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2167 DataArrayInt *ret=DataArrayInt::New();
2168 ret->alloc((int)cells.size(),1);
2169 std::copy(cells.begin(),cells.end(),ret->getPointer());
2170 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2173 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2177 DataArrayDoubleTuple *aa;
2178 std::vector<double> bb;
2180 int spaceDim=self->getSpaceDimension();
2181 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2182 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2183 self->orientCorrectly2DCells(v,polyOnly);
2186 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2188 std::vector<int> cells;
2189 self->arePolyhedronsNotCorrectlyOriented(cells);
2190 DataArrayInt *ret=DataArrayInt::New();
2191 ret->alloc((int)cells.size(),1);
2192 std::copy(cells.begin(),cells.end(),ret->getPointer());
2193 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2196 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2200 self->getFastAveragePlaneOfThis(vec,pos);
2202 std::copy(vec,vec+3,vals);
2203 std::copy(pos,pos+3,vals+3);
2204 return convertDblArrToPyListOfTuple(vals,3,2);
2207 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2209 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2210 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2211 return MEDCouplingUMesh::MergeUMeshes(tmp);
2214 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2217 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2218 PyObject *ret=PyTuple_New(2);
2219 PyObject *ret0Py=ret0?Py_True:Py_False;
2221 PyTuple_SetItem(ret,0,ret0Py);
2222 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2226 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2229 bool ret0=self->areCellsIncludedIn2(other,ret1);
2230 PyObject *ret=PyTuple_New(2);
2231 PyObject *ret0Py=ret0?Py_True:Py_False;
2233 PyTuple_SetItem(ret,0,ret0Py);
2234 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2238 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2240 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2241 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2242 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2243 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2244 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2245 PyObject *ret=PyTuple_New(5);
2246 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2247 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2248 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2249 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2250 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2254 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2256 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2257 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2258 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2259 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2260 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2261 PyObject *ret=PyTuple_New(5);
2262 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2263 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2264 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2265 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2266 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2270 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2272 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2273 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2274 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2275 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2276 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2277 PyObject *ret=PyTuple_New(5);
2278 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2279 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2280 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2281 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2282 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2286 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2288 DataArrayInt *neighbors=0,*neighborsIdx=0;
2289 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2290 PyObject *ret=PyTuple_New(2);
2291 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2292 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2296 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2298 DataArrayInt *neighbors=0,*neighborsIdx=0;
2299 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2300 PyObject *ret=PyTuple_New(2);
2301 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2302 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2306 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2308 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2309 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2310 DataArrayInt *d2,*d3,*d4,*dd5;
2311 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2312 PyObject *ret=PyTuple_New(7);
2313 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2314 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2315 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2316 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2317 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2318 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2319 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2323 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2326 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2327 da->checkAllocated();
2328 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2331 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2334 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2335 da->checkAllocated();
2336 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2339 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2342 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2343 da->checkAllocated();
2344 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2347 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2350 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2351 da->checkAllocated();
2352 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2353 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2354 PyObject *res = PyList_New(result.size());
2355 for (int i=0;iL!=result.end(); i++, iL++)
2356 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2360 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2363 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2364 da->checkAllocated();
2365 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2366 ret->setName(da->getName().c_str());
2370 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2372 DataArrayInt *cellNb1=0,*cellNb2=0;
2373 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2374 PyObject *ret=PyTuple_New(3);
2375 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2376 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2377 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2381 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2383 int spaceDim=self->getSpaceDimension();
2385 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2387 DataArrayDouble *a,*a2;
2388 DataArrayDoubleTuple *aa,*aa2;
2389 std::vector<double> bb,bb2;
2391 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2392 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2393 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2394 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2396 DataArrayInt *cellIds=0;
2397 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2398 PyObject *ret=PyTuple_New(2);
2399 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2400 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2404 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2406 int spaceDim=self->getSpaceDimension();
2408 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2410 DataArrayDouble *a,*a2;
2411 DataArrayDoubleTuple *aa,*aa2;
2412 std::vector<double> bb,bb2;
2414 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2415 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2416 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2417 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2419 DataArrayInt *cellIds=0;
2420 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2421 PyObject *ret=PyTuple_New(2);
2422 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2423 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2427 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2429 int spaceDim=self->getSpaceDimension();
2431 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2433 DataArrayDouble *a,*a2;
2434 DataArrayDoubleTuple *aa,*aa2;
2435 std::vector<double> bb,bb2;
2437 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2438 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2439 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2440 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2441 return self->getCellIdsCrossingPlane(orig,vect,eps);
2444 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2448 std::vector<int> pos2;
2449 DataArrayInt *pos3=0;
2450 DataArrayIntTuple *pos4=0;
2451 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2456 self->convertToPolyTypes(&pos1,&pos1+1);
2463 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2468 self->convertToPolyTypes(pos3->begin(),pos3->end());
2472 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2476 void convertAllToPoly();
2477 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2478 bool unPolyze() throw(INTERP_KERNEL::Exception);
2479 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2480 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2481 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2484 //== MEDCouplingUMesh End
2486 //== MEDCouplingExtrudedMesh
2488 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2491 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2492 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2494 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2496 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2499 std::string __str__() const throw(INTERP_KERNEL::Exception)
2501 return self->simpleRepr();
2504 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2506 std::ostringstream oss;
2507 self->reprQuickOverview(oss);
2511 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2513 MEDCouplingUMesh *ret=self->getMesh2D();
2516 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2518 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2520 MEDCouplingUMesh *ret=self->getMesh1D();
2523 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2525 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2527 DataArrayInt *ret=self->getMesh3DIds();
2530 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2535 //== MEDCouplingExtrudedMesh End
2537 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2540 static MEDCoupling1GTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2541 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2542 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2543 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2544 virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2545 virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
2548 virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2550 int szArr,sw,iTypppArr;
2551 std::vector<int> stdvecTyyppArr;
2552 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2553 self->insertNextCell(tmp,tmp+szArr);
2556 virtual DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2558 DataArrayInt *ret=self->getNodalConnectivity();
2559 if(ret) ret->incrRef();
2563 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2565 std::vector< const MEDCoupling1GTUMesh *> parts;
2566 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
2567 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
2572 //== MEDCoupling1SGTUMesh
2574 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2577 static MEDCoupling1SGTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2578 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2579 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2580 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2581 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2582 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2583 MEDCoupling1GTUMesh *computeDualMesh() const throw(INTERP_KERNEL::Exception);
2584 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const throw(INTERP_KERNEL::Exception);
2585 DataArrayInt *sortHexa8EachOther() throw(INTERP_KERNEL::Exception);
2588 MEDCoupling1SGTUMesh(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2590 return MEDCoupling1SGTUMesh::New(name,type);
2593 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2595 return MEDCoupling1SGTUMesh::New(m);
2598 std::string __str__() const throw(INTERP_KERNEL::Exception)
2600 return self->simpleRepr();
2603 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2605 std::ostringstream oss;
2606 self->reprQuickOverview(oss);
2610 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2612 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2613 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2614 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2617 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2619 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2620 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2621 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2626 //== MEDCoupling1SGTUMesh End
2628 //== MEDCoupling1DGTUMesh
2630 class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2633 static MEDCoupling1DGTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2634 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2635 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
2636 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2637 bool isPacked() const throw(INTERP_KERNEL::Exception);
2640 MEDCoupling1DGTUMesh(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2642 return MEDCoupling1DGTUMesh::New(name,type);
2645 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2647 return MEDCoupling1DGTUMesh::New(m);
2650 std::string __str__() const throw(INTERP_KERNEL::Exception)
2652 return self->simpleRepr();
2655 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2657 std::ostringstream oss;
2658 self->reprQuickOverview(oss);
2662 DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
2664 DataArrayInt *ret=self->getNodalConnectivityIndex();
2665 if(ret) ret->incrRef();
2669 PyObject *retrievePackedNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2671 DataArrayInt *ret1=0,*ret2=0;
2672 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
2673 PyObject *ret0Py=ret0?Py_True:Py_False;
2675 PyObject *ret=PyTuple_New(3);
2676 PyTuple_SetItem(ret,0,ret0Py);
2677 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2678 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2682 PyObject *copyWithNodalConnectivityPacked() const throw(INTERP_KERNEL::Exception)
2685 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
2686 PyObject *ret=PyTuple_New(2);
2687 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
2688 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
2689 PyTuple_SetItem(ret,1,ret1Py);
2693 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2695 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2696 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2697 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
2700 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2702 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2703 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2704 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
2707 static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt) throw(INTERP_KERNEL::Exception)
2709 std::vector<const ParaMEDMEM::DataArrayInt *> tmp;
2710 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2711 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
2716 //== MEDCoupling1DGTUMeshEnd
2718 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2721 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2722 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2723 virtual std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2724 std::vector<int> getCellGridStructure() const throw(INTERP_KERNEL::Exception);
2725 MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception);
2726 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
2729 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const throw(INTERP_KERNEL::Exception)
2731 int tmpp1=-1,tmpp2=-1;
2732 std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
2733 std::vector< std::pair<int,int> > inp;
2737 for(int i=0;i<tmpp1;i++)
2738 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2743 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
2744 inp.resize(tmpp1/2);
2745 for(int i=0;i<tmpp1/2;i++)
2746 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2749 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
2750 return self->buildStructuredSubPart(inp);
2753 static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) throw(INTERP_KERNEL::Exception)
2755 int tmpp1=-1,tmpp2=-1;
2756 std::vector<int> tmp=fillArrayWithPyListInt2(part,tmpp1,tmpp2);
2757 std::vector< std::pair<int,int> > inp;
2761 for(int i=0;i<tmpp1;i++)
2762 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2767 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.BuildExplicitIdsFrom : invalid input size ! Must be even size !");
2768 inp.resize(tmpp1/2);
2769 for(int i=0;i<tmpp1/2;i++)
2770 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2773 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.BuildExplicitIdsFrom : invalid input size !");
2775 int szArr,sw,iTypppArr;
2776 std::vector<int> stdvecTyyppArr;
2777 const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
2778 std::vector<int> tmp5(tmp4,tmp4+szArr);
2780 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
2783 static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) throw(INTERP_KERNEL::Exception)
2785 int szArr,sw,iTypppArr;
2786 std::vector<int> stdvecTyyppArr;
2787 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2788 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
2791 static PyObject *IsPartStructured(PyObject *li, PyObject *st) throw(INTERP_KERNEL::Exception)
2793 int szArr,sw,iTypppArr;
2794 std::vector<int> stdvecTyyppArr;
2795 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2796 int szArr2,sw2,iTypppArr2;
2797 std::vector<int> stdvecTyyppArr2;
2798 const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
2799 std::vector<int> tmp3(tmp2,tmp2+szArr2);
2800 std::vector< std::pair<int,int> > partCompactFormat;
2801 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
2802 PyObject *ret=PyTuple_New(2);
2803 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
2804 PyTuple_SetItem(ret,0,ret0Py);
2805 PyObject *ret1Py=PyList_New(partCompactFormat.size());
2806 for(std::size_t i=0;i<partCompactFormat.size();i++)
2808 PyObject *tmp4=PyTuple_New(2);
2809 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
2810 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
2811 PyList_SetItem(ret1Py,i,tmp4);
2813 PyTuple_SetItem(ret,1,ret1Py);
2819 //== MEDCouplingCMesh
2821 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2824 static MEDCouplingCMesh *New();
2825 static MEDCouplingCMesh *New(const char *meshName);
2826 MEDCouplingCMesh *clone(bool recDeepCpy) const;
2827 void setCoords(const DataArrayDouble *coordsX,
2828 const DataArrayDouble *coordsY=0,
2829 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
2830 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
2834 return MEDCouplingCMesh::New();
2836 MEDCouplingCMesh(const char *meshName)
2838 return MEDCouplingCMesh::New(meshName);
2840 std::string __str__() const throw(INTERP_KERNEL::Exception)
2842 return self->simpleRepr();
2844 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2846 std::ostringstream oss;
2847 self->reprQuickOverview(oss);
2850 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
2852 DataArrayDouble *ret=self->getCoordsAt(i);
2860 //== MEDCouplingCMesh End
2862 //== MEDCouplingCurveLinearMesh
2864 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2867 static MEDCouplingCurveLinearMesh *New();
2868 static MEDCouplingCurveLinearMesh *New(const char *meshName);
2869 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
2870 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
2872 MEDCouplingCurveLinearMesh()
2874 return MEDCouplingCurveLinearMesh::New();
2876 MEDCouplingCurveLinearMesh(const char *meshName)
2878 return MEDCouplingCurveLinearMesh::New(meshName);
2880 std::string __str__() const throw(INTERP_KERNEL::Exception)
2882 return self->simpleRepr();
2884 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2886 std::ostringstream oss;
2887 self->reprQuickOverview(oss);
2890 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
2892 DataArrayDouble *ret=self->getCoords();
2897 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
2899 int szArr,sw,iTypppArr;
2900 std::vector<int> stdvecTyyppArr;
2901 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
2902 self->setNodeGridStructure(tmp,tmp+szArr);
2907 //== MEDCouplingCurveLinearMesh End
2910 namespace ParaMEDMEM
2912 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
2915 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
2916 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
2917 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2918 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2919 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
2920 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
2921 void setName(const char *name) throw(INTERP_KERNEL::Exception);
2922 std::string getDescription() const throw(INTERP_KERNEL::Exception);
2923 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
2924 std::string getName() const throw(INTERP_KERNEL::Exception);
2925 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
2926 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
2927 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
2928 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
2929 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
2930 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
2931 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
2932 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
2933 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
2934 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
2935 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
2936 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
2937 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
2938 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
2939 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
2940 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
2942 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
2944 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
2947 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
2950 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
2952 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
2955 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
2958 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
2960 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
2961 return convertIntArrToPyList3(ret);
2964 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
2967 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
2968 PyObject *ret=PyTuple_New(2);
2969 PyObject *ret0Py=ret0?Py_True:Py_False;
2971 PyTuple_SetItem(ret,0,ret0Py);
2972 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2976 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
2978 DataArrayInt *ret1=0;
2979 MEDCouplingMesh *ret0=0;
2981 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2982 if (!SWIG_IsOK(res1))
2985 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2986 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
2990 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2992 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2993 da2->checkAllocated();
2994 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
2996 PyObject *res = PyList_New(2);
2997 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
2998 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3002 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
3004 DataArrayInt *ret1=0;
3006 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3007 PyObject *res=PyTuple_New(2);
3008 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3010 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3013 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3014 PyTuple_SetItem(res,1,res1);
3019 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3022 int v0; std::vector<int> v1;
3023 const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
3024 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3027 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3028 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3031 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3032 if (!SWIG_IsOK(res1))
3035 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3036 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3040 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3042 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3043 da2->checkAllocated();
3044 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3048 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3050 std::vector<int> tmp;
3051 self->getCellIdsHavingGaussLocalization(locId,tmp);
3052 DataArrayInt *ret=DataArrayInt::New();
3053 ret->alloc((int)tmp.size(),1);
3054 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3055 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3058 int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
3060 std::vector<int> inp0;
3061 convertPyToNewIntArr4(code,1,3,inp0);
3062 std::vector<const DataArrayInt *> inp1;
3063 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(idsPerType,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",inp1);
3064 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3069 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3072 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3073 static MEDCouplingFieldTemplate *New(TypeOfField type);
3074 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3075 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3078 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3080 return MEDCouplingFieldTemplate::New(f);
3083 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3085 return MEDCouplingFieldTemplate::New(type);
3088 std::string __str__() const throw(INTERP_KERNEL::Exception)
3090 return self->simpleRepr();
3093 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3095 std::ostringstream oss;
3096 self->reprQuickOverview(oss);
3102 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3105 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3106 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3107 void setTimeUnit(const char *unit);
3108 const char *getTimeUnit() const;
3109 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3110 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3111 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3112 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3113 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3114 void writeVTK(const char *fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
3115 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3116 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3117 MEDCouplingFieldDouble *deepCpy() const;
3118 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3119 MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
3120 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3121 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3122 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3123 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3124 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3125 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3126 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3127 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3128 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3129 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3130 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3131 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3132 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3133 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3134 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3135 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3136 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3137 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3138 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3139 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3140 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3141 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3142 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3143 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3144 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3145 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3146 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3147 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3148 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3149 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3150 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3151 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3152 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3153 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3154 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3155 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3156 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3157 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3158 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3159 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3160 void fillFromAnalytic(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3161 void fillFromAnalytic2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3162 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
3163 void applyFunc(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3164 void applyFunc2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3165 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
3166 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3167 void applyFunc(const char *func) throw(INTERP_KERNEL::Exception);
3168 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
3169 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
3170 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3171 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3172 double getMinValue() const throw(INTERP_KERNEL::Exception);
3173 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3174 double norm2() const throw(INTERP_KERNEL::Exception);
3175 double normMax() const throw(INTERP_KERNEL::Exception);
3176 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3177 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3178 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3179 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3180 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3181 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3182 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3183 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3184 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3185 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3186 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3187 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3188 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3189 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3190 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3191 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3192 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3193 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3194 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3195 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3196 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3197 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3199 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3201 return MEDCouplingFieldDouble::New(type,td);
3204 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3206 return MEDCouplingFieldDouble::New(ft,td);
3209 std::string __str__() const throw(INTERP_KERNEL::Exception)
3211 return self->simpleRepr();
3214 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3216 std::ostringstream oss;
3217 self->reprQuickOverview(oss);
3221 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3223 DataArrayDouble *ret=self->getArray();
3229 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3231 std::vector<DataArrayDouble *> arrs=self->getArrays();
3232 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3236 PyObject *ret=PyTuple_New(sz);
3237 for(int i=0;i<sz;i++)
3240 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3242 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3247 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3249 std::vector<const DataArrayDouble *> tmp;
3250 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3252 std::vector<DataArrayDouble *> arrs(sz);
3253 for(int i=0;i<sz;i++)
3254 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3255 self->setArrays(arrs);
3258 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3260 DataArrayDouble *ret=self->getEndArray();
3266 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3270 DataArrayDoubleTuple *aa;
3271 std::vector<double> bb;
3273 const MEDCouplingMesh *mesh=self->getMesh();
3275 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3276 int spaceDim=mesh->getSpaceDimension();
3277 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3278 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3280 int sz=self->getNumberOfComponents();
3281 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3282 self->getValueOn(spaceLoc,res);
3283 return convertDblArrToPyList(res,sz);
3286 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3288 int sz=self->getNumberOfComponents();
3289 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3290 self->getValueOnPos(i,j,k,res);
3291 return convertDblArrToPyList(res,sz);
3294 DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
3296 const MEDCouplingMesh *mesh(self->getMesh());
3298 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3301 double v0; ParaMEDMEM::DataArrayDouble *v1(0); ParaMEDMEM::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
3302 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
3303 mesh->getSpaceDimension(),true,nbPts);
3304 return self->getValueOnMulti(inp,nbPts);
3307 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3311 DataArrayDoubleTuple *aa;
3312 std::vector<double> bb;
3314 const MEDCouplingMesh *mesh=self->getMesh();
3316 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3317 int spaceDim=mesh->getSpaceDimension();
3318 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3319 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3322 int sz=self->getNumberOfComponents();
3323 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3324 self->getValueOn(spaceLoc,time,res);
3325 return convertDblArrToPyList(res,sz);
3328 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3330 if(self->getArray()!=0)
3331 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3334 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3335 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3336 self->setArray(arr);
3340 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3343 double tmp0=self->getTime(tmp1,tmp2);
3344 PyObject *res = PyList_New(3);
3345 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3346 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3347 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3351 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3354 double tmp0=self->getStartTime(tmp1,tmp2);
3355 PyObject *res = PyList_New(3);
3356 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3357 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3358 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3362 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3365 double tmp0=self->getEndTime(tmp1,tmp2);
3366 PyObject *res = PyList_New(3);
3367 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3368 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3369 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3372 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3374 int sz=self->getNumberOfComponents();
3375 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3376 self->accumulate(tmp);
3377 return convertDblArrToPyList(tmp,sz);
3379 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3381 int sz=self->getNumberOfComponents();
3382 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3383 self->integral(isWAbs,tmp);
3384 return convertDblArrToPyList(tmp,sz);
3386 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3388 int sz=self->getNumberOfComponents();
3389 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3390 self->getWeightedAverageValue(tmp,isWAbs);
3391 return convertDblArrToPyList(tmp,sz);
3393 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3395 int sz=self->getNumberOfComponents();
3396 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3398 return convertDblArrToPyList(tmp,sz);
3400 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3402 int sz=self->getNumberOfComponents();
3403 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3405 return convertDblArrToPyList(tmp,sz);
3407 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3409 int szArr,sw,iTypppArr;
3410 std::vector<int> stdvecTyyppArr;
3411 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3412 self->renumberCells(tmp,check);
3415 void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3417 int szArr,sw,iTypppArr;
3418 std::vector<int> stdvecTyyppArr;
3419 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3420 self->renumberCellsWithoutMesh(tmp,check);
3423 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3425 int szArr,sw,iTypppArr;
3426 std::vector<int> stdvecTyyppArr;
3427 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3428 self->renumberNodes(tmp,eps);
3431 void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3433 int szArr,sw,iTypppArr;
3434 std::vector<int> stdvecTyyppArr;
3435 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3436 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
3439 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3443 std::vector<int> multiVal;
3444 std::pair<int, std::pair<int,int> > slic;
3445 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3446 const MEDCouplingMesh *mesh=self->getMesh();
3448 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3449 int nbc=mesh->getNumberOfCells();
3450 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3457 std::ostringstream oss;
3458 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3459 throw INTERP_KERNEL::Exception(oss.str().c_str());
3462 return self->buildSubPart(&singleVal,&singleVal+1);
3467 int tmp=nbc+singleVal;
3468 return self->buildSubPart(&tmp,&tmp+1);
3472 std::ostringstream oss;
3473 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3474 throw INTERP_KERNEL::Exception(oss.str().c_str());
3480 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3484 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3489 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3490 daIntTyypp->checkAllocated();
3491 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3494 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3498 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3500 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";
3501 if(PyTuple_Check(li))
3503 Py_ssize_t sz=PyTuple_Size(li);
3505 throw INTERP_KERNEL::Exception(msg);
3506 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3509 std::vector<int> multiVal;
3510 std::pair<int, std::pair<int,int> > slic;
3511 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3512 if(!self->getArray())
3513 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3515 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3516 catch(INTERP_KERNEL::Exception& e)
3517 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3518 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3519 DataArrayDouble *ret0Arr=ret0->getArray();
3521 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3526 std::vector<int> v2(1,singleVal);
3527 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3528 ret0->setArray(aarr);
3533 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3534 ret0->setArray(aarr);
3539 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3540 std::vector<int> v2(nbOfComp);
3541 for(int i=0;i<nbOfComp;i++)
3542 v2[i]=slic.first+i*slic.second.second;
3543 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3544 ret0->setArray(aarr);
3548 throw INTERP_KERNEL::Exception(msg);
3553 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3556 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3559 double r1=self->getMaxValue2(tmp);
3560 PyObject *ret=PyTuple_New(2);
3561 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3562 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3566 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3569 double r1=self->getMinValue2(tmp);
3570 PyObject *ret=PyTuple_New(2);
3571 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3572 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3576 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3578 std::vector<int> tmp;
3579 convertPyToNewIntArr3(li,tmp);
3580 return self->keepSelectedComponents(tmp);
3583 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3585 std::vector<int> tmp;
3586 convertPyToNewIntArr3(li,tmp);
3587 self->setSelectedComponents(f,tmp);
3590 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3593 DataArrayDouble *a,*a2;
3594 DataArrayDoubleTuple *aa,*aa2;
3595 std::vector<double> bb,bb2;
3598 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
3599 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
3600 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3601 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3603 return self->extractSlice3D(orig,vect,eps);
3606 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3608 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
3611 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3613 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
3616 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3618 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.";
3619 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
3622 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3624 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3626 return (*self)-(*other);
3628 throw INTERP_KERNEL::Exception(msg);
3633 DataArrayDoubleTuple *aa;
3634 std::vector<double> bb;
3636 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3641 if(!self->getArray())
3642 throw INTERP_KERNEL::Exception(msg2);
3643 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3644 ret->applyLin(1.,-val);
3645 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3646 ret2->setArray(ret);
3651 if(!self->getArray())
3652 throw INTERP_KERNEL::Exception(msg2);
3653 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
3654 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3655 ret2->setArray(ret);
3660 if(!self->getArray())
3661 throw INTERP_KERNEL::Exception(msg2);
3662 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3663 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3664 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3665 ret2->setArray(ret);
3670 if(!self->getArray())
3671 throw INTERP_KERNEL::Exception(msg2);
3672 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3673 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3674 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3675 ret2->setArray(ret);
3679 { throw INTERP_KERNEL::Exception(msg); }
3683 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3685 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
3688 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3690 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
3693 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3695 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
3698 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3700 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.";
3701 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
3704 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3706 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3708 return (*self)/(*other);
3710 throw INTERP_KERNEL::Exception(msg);
3715 DataArrayDoubleTuple *aa;
3716 std::vector<double> bb;
3718 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3724 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
3725 if(!self->getArray())
3726 throw INTERP_KERNEL::Exception(msg2);
3727 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3728 ret->applyLin(1./val,0);
3729 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3730 ret2->setArray(ret);
3735 if(!self->getArray())
3736 throw INTERP_KERNEL::Exception(msg2);
3737 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
3738 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3739 ret2->setArray(ret);
3744 if(!self->getArray())
3745 throw INTERP_KERNEL::Exception(msg2);
3746 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3747 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3748 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3749 ret2->setArray(ret);
3754 if(!self->getArray())
3755 throw INTERP_KERNEL::Exception(msg2);
3756 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3757 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3758 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3759 ret2->setArray(ret);
3763 { throw INTERP_KERNEL::Exception(msg); }
3767 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3769 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
3772 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3774 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.";
3775 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
3778 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3780 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3782 return (*self)^(*other);
3784 throw INTERP_KERNEL::Exception(msg);
3789 DataArrayDoubleTuple *aa;
3790 std::vector<double> bb;
3792 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3797 if(!self->getArray())
3798 throw INTERP_KERNEL::Exception(msg2);
3799 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3801 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3802 ret2->setArray(ret);
3807 if(!self->getArray())
3808 throw INTERP_KERNEL::Exception(msg2);
3809 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
3810 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3811 ret2->setArray(ret);
3816 if(!self->getArray())
3817 throw INTERP_KERNEL::Exception(msg2);
3818 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3819 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3820 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3821 ret2->setArray(ret);
3826 if(!self->getArray())
3827 throw INTERP_KERNEL::Exception(msg2);
3828 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3829 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3830 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3831 ret2->setArray(ret);
3835 { throw INTERP_KERNEL::Exception(msg); }
3839 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
3841 return self->negate();
3844 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3846 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.";
3847 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
3850 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3852 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3856 Py_XINCREF(trueSelf);
3860 throw INTERP_KERNEL::Exception(msg);
3865 DataArrayDoubleTuple *aa;
3866 std::vector<double> bb;
3868 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3873 if(!self->getArray())
3874 throw INTERP_KERNEL::Exception(msg2);
3875 self->getArray()->applyLin(1.,val);
3876 Py_XINCREF(trueSelf);
3881 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3884 Py_XINCREF(trueSelf);
3889 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3890 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3891 ret2->setArray(aaa);
3893 Py_XINCREF(trueSelf);
3898 if(!self->getArray())
3899 throw INTERP_KERNEL::Exception(msg2);
3900 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3901 self->getArray()->addEqual(aaa);
3902 Py_XINCREF(trueSelf);
3906 { throw INTERP_KERNEL::Exception(msg); }
3910 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3912 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.";
3913 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
3916 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3918 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3922 Py_XINCREF(trueSelf);
3926 throw INTERP_KERNEL::Exception(msg);
3931 DataArrayDoubleTuple *aa;
3932 std::vector<double> bb;
3934 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3939 if(!self->getArray())
3940 throw INTERP_KERNEL::Exception(msg2);
3941 self->getArray()->applyLin(1.,-val);
3942 Py_XINCREF(trueSelf);
3947 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3950 Py_XINCREF(trueSelf);
3955 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3956 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3957 ret2->setArray(aaa);
3959 Py_XINCREF(trueSelf);
3964 if(!self->getArray())
3965 throw INTERP_KERNEL::Exception(msg2);
3966 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3967 self->getArray()->substractEqual(aaa);
3968 Py_XINCREF(trueSelf);
3972 { throw INTERP_KERNEL::Exception(msg); }
3976 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3978 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.";
3979 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
3982 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3984 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3988 Py_XINCREF(trueSelf);
3992 throw INTERP_KERNEL::Exception(msg);
3997 DataArrayDoubleTuple *aa;
3998 std::vector<double> bb;
4000 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4005 if(!self->getArray())
4006 throw INTERP_KERNEL::Exception(msg2);
4007 self->getArray()->applyLin(val,0);
4008 Py_XINCREF(trueSelf);
4013 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4016 Py_XINCREF(trueSelf);
4021 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4022 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4023 ret2->setArray(aaa);
4025 Py_XINCREF(trueSelf);
4030 if(!self->getArray())
4031 throw INTERP_KERNEL::Exception(msg2);
4032 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4033 self->getArray()->multiplyEqual(aaa);
4034 Py_XINCREF(trueSelf);
4038 { throw INTERP_KERNEL::Exception(msg); }
4042 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4044 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.";
4045 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4048 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4050 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4054 Py_XINCREF(trueSelf);
4058 throw INTERP_KERNEL::Exception(msg);
4063 DataArrayDoubleTuple *aa;
4064 std::vector<double> bb;
4066 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4072 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4073 if(!self->getArray())
4074 throw INTERP_KERNEL::Exception(msg2);
4075 self->getArray()->applyLin(1./val,0);
4076 Py_XINCREF(trueSelf);
4081 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4084 Py_XINCREF(trueSelf);
4089 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4090 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4091 ret2->setArray(aaa);
4093 Py_XINCREF(trueSelf);
4098 if(!self->getArray())
4099 throw INTERP_KERNEL::Exception(msg2);
4100 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4101 self->getArray()->divideEqual(aaa);
4102 Py_XINCREF(trueSelf);
4106 { throw INTERP_KERNEL::Exception(msg); }
4110 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4112 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.";
4113 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4116 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4118 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4122 Py_XINCREF(trueSelf);
4126 throw INTERP_KERNEL::Exception(msg);
4131 DataArrayDoubleTuple *aa;
4132 std::vector<double> bb;
4134 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4139 if(!self->getArray())
4140 throw INTERP_KERNEL::Exception(msg2);
4141 self->getArray()->applyPow(val);
4142 Py_XINCREF(trueSelf);
4147 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4150 Py_XINCREF(trueSelf);
4155 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4156 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4157 ret2->setArray(aaa);
4159 Py_XINCREF(trueSelf);
4164 if(!self->getArray())
4165 throw INTERP_KERNEL::Exception(msg2);
4166 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4167 self->getArray()->powEqual(aaa);
4168 Py_XINCREF(trueSelf);
4172 { throw INTERP_KERNEL::Exception(msg); }
4176 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4178 std::vector<const MEDCouplingFieldDouble *> tmp;
4179 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4180 return MEDCouplingFieldDouble::MergeFields(tmp);
4183 static void WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
4185 std::vector<const MEDCouplingFieldDouble *> tmp;
4186 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4187 MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4192 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4195 int getNumberOfFields() const;
4196 MEDCouplingMultiFields *deepCpy() const;
4197 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4198 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4199 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4200 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4201 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4204 std::string __str__() const throw(INTERP_KERNEL::Exception)
4206 return self->simpleRepr();
4208 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4210 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4211 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4213 std::vector<MEDCouplingFieldDouble *> fs(sz);
4214 for(int i=0;i<sz;i++)
4215 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4216 return MEDCouplingMultiFields::New(fs);
4218 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4220 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4221 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4223 std::vector<MEDCouplingFieldDouble *> fs(sz);
4224 for(int i=0;i<sz;i++)
4225 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4226 return MEDCouplingMultiFields::New(fs);
4228 PyObject *getFields() const
4230 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4231 int sz=fields.size();
4232 PyObject *res = PyList_New(sz);
4233 for(int i=0;i<sz;i++)
4237 fields[i]->incrRef();
4238 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4242 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4247 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4249 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4253 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4256 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4258 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4260 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4262 PyObject *res = PyList_New(sz);
4263 for(int i=0;i<sz;i++)
4268 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4272 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4277 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4279 std::vector<int> refs;
4280 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4282 PyObject *res = PyList_New(sz);
4283 for(int i=0;i<sz;i++)
4288 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4292 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4296 PyObject *ret=PyTuple_New(2);
4297 PyTuple_SetItem(ret,0,res);
4298 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4301 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4303 std::vector<DataArrayDouble *> ms=self->getArrays();
4305 PyObject *res = PyList_New(sz);
4306 for(int i=0;i<sz;i++)
4311 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4315 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4320 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4322 std::vector< std::vector<int> > refs;
4323 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4325 PyObject *res = PyList_New(sz);
4326 PyObject *res2 = PyList_New(sz);
4327 for(int i=0;i<sz;i++)
4332 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4336 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4338 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4341 PyObject *ret=PyTuple_New(2);
4342 PyTuple_SetItem(ret,0,res);
4343 PyTuple_SetItem(ret,1,res2);
4349 class MEDCouplingDefinitionTime
4352 MEDCouplingDefinitionTime();
4353 void assign(const MEDCouplingDefinitionTime& other);
4354 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4355 double getTimeResolution() const;
4356 std::vector<double> getHotSpotsTime() const;
4359 std::string __str__() const throw(INTERP_KERNEL::Exception)
4361 std::ostringstream oss;
4362 self->appendRepr(oss);
4366 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4368 int meshId,arrId,arrIdInField,fieldId;
4369 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4370 PyObject *res=PyList_New(4);
4371 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4372 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4373 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4374 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4378 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4380 int meshId,arrId,arrIdInField,fieldId;
4381 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4382 PyObject *res=PyList_New(4);
4383 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4384 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4385 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4386 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4392 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4395 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4396 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4400 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4402 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4403 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4405 std::vector<MEDCouplingFieldDouble *> fs(sz);
4406 for(int i=0;i<sz;i++)
4407 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4408 return MEDCouplingFieldOverTime::New(fs);
4410 std::string __str__() const throw(INTERP_KERNEL::Exception)
4412 return self->simpleRepr();
4414 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4416 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4417 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4419 std::vector<MEDCouplingFieldDouble *> fs(sz);
4420 for(int i=0;i<sz;i++)
4421 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4422 return MEDCouplingFieldOverTime::New(fs);
4430 __filename=os.environ.get('PYTHONSTARTUP')
4431 if __filename and os.path.isfile(__filename):
4432 execfile(__filename)