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::MEDCouplingUMeshCellByTypeEntry::__iter__;
269 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
270 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::New;
271 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::getNodalConnectivity;
272 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
273 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::New;
274 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
275 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::computeDualMesh;
276 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
277 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::sortHexa8EachOther;
278 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
279 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
280 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::New;
281 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
282 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
283 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
284 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
285 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
286 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
287 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::buildStructuredSubPart;
288 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTUnstructured;
289 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
290 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
291 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
292 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
293 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
294 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
295 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
296 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
297 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
298 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
299 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
301 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
302 %feature("unref") MEDCouplingMesh "$this->decrRef();"
303 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
304 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
305 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
306 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
307 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
308 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
309 %feature("unref") MEDCouplingField "$this->decrRef();"
310 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
311 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
312 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
313 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
314 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
315 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
316 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
317 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
318 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
320 %rename(assign) *::operator=;
321 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
322 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
323 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
324 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
328 %rename (InterpKernelException) INTERP_KERNEL::Exception;
330 %include "MEDCouplingRefCountObject.i"
331 %include "MEDCouplingMemArray.i"
349 CONST_ON_TIME_INTERVAL = 7
350 } TypeOfTimeDiscretization;
358 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
359 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11
360 } MEDCouplingMeshType;
363 class DataArrayDouble;
364 class MEDCouplingUMesh;
365 class MEDCouplingFieldDouble;
367 %extend RefCountObject
369 std::string getHiddenCppPointer() const
371 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
376 %extend MEDCouplingGaussLocalization
378 std::string __str__() const throw(INTERP_KERNEL::Exception)
380 return self->getStringRepr();
383 std::string __repr__() const throw(INTERP_KERNEL::Exception)
385 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
386 oss << self->getStringRepr();
393 class MEDCouplingMesh : public RefCountObject, public TimeLabel
396 void setName(const char *name);
397 std::string getName() const;
398 void setDescription(const char *descr);
399 std::string getDescription() const;
400 void setTime(double val, int iteration, int order);
401 void setTimeUnit(const char *unit);
402 const char *getTimeUnit() const;
403 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
404 bool isStructured() const throw(INTERP_KERNEL::Exception);
405 virtual MEDCouplingMesh *deepCpy() const;
406 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
407 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
408 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
409 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
410 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
411 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
412 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
413 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
414 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
415 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
416 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
417 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
418 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
419 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
420 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
421 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
422 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
423 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
424 virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
425 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
426 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
427 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
428 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
429 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
430 void writeVTK(const char *fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
432 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
433 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
434 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
435 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
436 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
437 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
438 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
439 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
440 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
441 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
442 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
443 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
444 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
445 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
446 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
447 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
448 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
451 std::string __str__() const throw(INTERP_KERNEL::Exception)
453 return self->simpleRepr();
456 PyObject *getTime() throw(INTERP_KERNEL::Exception)
459 double tmp0=self->getTime(tmp1,tmp2);
460 PyObject *res = PyList_New(3);
461 PyList_SetItem(res,0,SWIG_From_double(tmp0));
462 PyList_SetItem(res,1,SWIG_From_int(tmp1));
463 PyList_SetItem(res,2,SWIG_From_int(tmp2));
467 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
471 DataArrayDoubleTuple *aa;
472 std::vector<double> bb;
474 int spaceDim=self->getSpaceDimension();
475 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
476 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
477 return self->getCellContainingPoint(pos,eps);
480 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
484 DataArrayDoubleTuple *aa;
485 std::vector<double> bb;
487 int spaceDim=self->getSpaceDimension();
488 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
489 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
490 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
491 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
492 PyObject *ret=PyTuple_New(2);
493 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
494 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
498 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
500 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
501 int spaceDim=self->getSpaceDimension();
503 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
504 if (!SWIG_IsOK(res1))
507 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
508 int nbOfPoints=size/spaceDim;
511 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
513 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
517 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
519 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
520 da2->checkAllocated();
521 int size=da2->getNumberOfTuples();
522 int nbOfCompo=da2->getNumberOfComponents();
523 if(nbOfCompo!=spaceDim)
525 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
527 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
529 PyObject *ret=PyTuple_New(2);
530 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
531 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
535 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
539 DataArrayDoubleTuple *aa;
540 std::vector<double> bb;
542 int spaceDim=self->getSpaceDimension();
543 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
544 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
545 std::vector<int> elts;
546 self->getCellsContainingPoint(pos,eps,elts);
547 DataArrayInt *ret=DataArrayInt::New();
548 ret->alloc((int)elts.size(),1);
549 std::copy(elts.begin(),elts.end(),ret->getPointer());
550 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
553 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
556 int v0; std::vector<int> v1;
557 const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
558 self->renumberCells(ids,check);
561 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
563 DataArrayInt *cellCor, *nodeCor;
564 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
565 PyObject *res = PyList_New(2);
566 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
567 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
571 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
573 DataArrayInt *cellCor=0,*nodeCor=0;
574 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
575 PyObject *res = PyList_New(2);
576 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
577 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
581 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
583 DataArrayInt *cellCor=0;
584 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
588 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
591 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
592 if (!SWIG_IsOK(res1))
595 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
596 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
600 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
602 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
603 da2->checkAllocated();
604 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
607 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
609 std::vector<int> conn;
610 self->getNodeIdsOfCell(cellId,conn);
611 return convertIntArrToPyList2(conn);
614 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
616 std::vector<double> coo;
617 self->getCoordinatesOfNode(nodeId,coo);
618 return convertDblArrToPyList2(coo);
621 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
625 DataArrayDoubleTuple *aa;
626 std::vector<double> bb;
628 int spaceDim=self->getSpaceDimension();
629 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
630 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
631 self->scale(pointPtr,factor);
634 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
636 int spaceDim=self->getSpaceDimension();
637 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
638 self->getBoundingBox(tmp);
639 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
643 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
646 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
647 PyObject *ret=PyTuple_New(2);
648 PyObject *ret0Py=ret0?Py_True:Py_False;
650 PyTuple_SetItem(ret,0,ret0Py);
651 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
655 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
657 int szArr,sw,iTypppArr;
658 std::vector<int> stdvecTyyppArr;
659 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
660 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
661 if(sw==3)//DataArrayInt
663 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
664 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
665 std::string name=argpt->getName();
667 ret->setName(name.c_str());
669 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
672 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
674 int szArr,sw,iTypppArr;
675 std::vector<int> stdvecTyyppArr;
677 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
678 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
679 if(sw==3)//DataArrayInt
681 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
682 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
683 std::string name=argpt->getName();
685 ret->setName(name.c_str());
688 PyObject *res = PyList_New(2);
689 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
690 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
691 PyList_SetItem(res,0,obj0);
692 PyList_SetItem(res,1,obj1);
696 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
700 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
701 PyObject *res = PyTuple_New(2);
702 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
705 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
707 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
708 PyTuple_SetItem(res,0,obj0);
709 PyTuple_SetItem(res,1,obj1);
713 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
715 std::vector<int> vals=self->getDistributionOfTypes();
717 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
718 PyObject *ret=PyList_New((int)vals.size()/3);
719 for(int j=0;j<(int)vals.size()/3;j++)
721 PyObject *ret1=PyList_New(3);
722 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
723 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
724 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
725 PyList_SetItem(ret,j,ret1);
730 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
732 std::vector<int> code;
733 std::vector<const DataArrayInt *> idsPerType;
734 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
735 convertPyToNewIntArr4(li,1,3,code);
736 return self->checkTypeConsistencyAndContig(code,idsPerType);
739 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
741 std::vector<int> code;
742 std::vector<DataArrayInt *> idsInPflPerType;
743 std::vector<DataArrayInt *> idsPerType;
744 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
745 PyObject *ret=PyTuple_New(3);
748 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
749 PyObject *ret0=PyList_New((int)code.size()/3);
750 for(int j=0;j<(int)code.size()/3;j++)
752 PyObject *ret00=PyList_New(3);
753 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
754 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
755 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
756 PyList_SetItem(ret0,j,ret00);
758 PyTuple_SetItem(ret,0,ret0);
760 PyObject *ret1=PyList_New(idsInPflPerType.size());
761 for(std::size_t j=0;j<idsInPflPerType.size();j++)
762 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
763 PyTuple_SetItem(ret,1,ret1);
764 int n=idsPerType.size();
765 PyObject *ret2=PyList_New(n);
767 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
768 PyTuple_SetItem(ret,2,ret2);
772 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
776 DataArrayDoubleTuple *aa;
777 std::vector<double> bb;
779 int spaceDim=self->getSpaceDimension();
780 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
781 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
782 self->translate(vectorPtr);
785 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
787 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
790 DataArrayDoubleTuple *aa;
791 std::vector<double> bb;
793 int spaceDim=self->getSpaceDimension();
794 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
795 self->rotate(centerPtr,0,alpha);
798 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
800 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
802 DataArrayDouble *a,*a2;
803 DataArrayDoubleTuple *aa,*aa2;
804 std::vector<double> bb,bb2;
806 int spaceDim=self->getSpaceDimension();
807 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
808 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
809 self->rotate(centerPtr,vectorPtr,alpha);
812 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
814 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
815 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
816 PyObject *res=PyList_New(result.size());
817 for(int i=0;iL!=result.end(); i++, iL++)
818 PyList_SetItem(res,i,PyInt_FromLong(*iL));
822 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
824 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
825 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
826 return MEDCouplingMesh::MergeMeshes(tmp);
832 //== MEDCouplingMesh End
834 %include "NormalizedGeometricTypes"
835 %include "MEDCouplingNatureOfFieldEnum"
839 class MEDCouplingNatureOfField
842 static const char *GetRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception);
843 static std::string GetReprNoThrow(NatureOfField nat);
844 static std::string GetAllPossibilitiesStr();
848 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
849 // include "MEDCouplingTimeDiscretization.i"
853 class MEDCouplingGaussLocalization
856 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
857 const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
858 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
859 INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
860 void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
861 int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
862 int getDimension() const throw(INTERP_KERNEL::Exception);
863 int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
864 std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
865 void checkCoherency() const throw(INTERP_KERNEL::Exception);
866 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception);
868 const std::vector<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
869 double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
870 const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
871 double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
872 const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
873 double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
874 void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
875 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
876 void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
877 void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
878 void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
879 void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
881 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
885 %include "MEDCouplingFieldDiscretization.i"
887 //== MEDCouplingPointSet
891 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
894 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
895 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
896 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
897 void zipCoords() throw(INTERP_KERNEL::Exception);
898 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
899 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
900 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
901 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
902 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
903 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
904 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
905 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
906 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
907 static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception);
908 virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
909 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
910 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
911 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
912 virtual DataArrayInt *findBoundaryNodes() const;
913 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
914 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
915 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
916 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
917 virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
918 virtual DataArrayDouble *getBoundingBoxForBBTree() const throw(INTERP_KERNEL::Exception);
921 std::string __str__() const throw(INTERP_KERNEL::Exception)
923 return self->simpleRepr();
926 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
929 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
930 PyObject *res = PyList_New(2);
931 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
932 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
936 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
938 DataArrayInt *comm, *commIndex;
939 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
940 PyObject *res = PyList_New(2);
941 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
942 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
946 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
948 DataArrayDouble *ret1=self->getCoords();
951 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
954 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
956 int szArr,sw,iTypppArr;
957 std::vector<int> stdvecTyyppArr;
958 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
959 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
960 if(sw==3)//DataArrayInt
962 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
963 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
964 std::string name=argpt->getName();
966 ret->setName(name.c_str());
968 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
971 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
973 int szArr,sw,iTypppArr;
974 std::vector<int> stdvecTyyppArr;
975 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
976 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
977 if(sw==3)//DataArrayInt
979 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
980 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
981 std::string name=argpt->getName();
983 ret->setName(name.c_str());
985 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
988 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
990 int szArr,sw,iTypppArr;
991 std::vector<int> stdvecTyyppArr;
992 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
993 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
994 if(sw==3)//DataArrayInt
996 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
997 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
998 std::string name=argpt->getName();
1000 ret->setName(name.c_str());
1002 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1005 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1007 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1008 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1011 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1013 int szArr,sw,iTypppArr;
1014 std::vector<int> stdvecTyyppArr;
1015 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1016 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1017 if(sw==3)//DataArrayInt
1019 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1020 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1021 std::string name=argpt->getName();
1023 ret->setName(name.c_str());
1025 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1028 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1030 int szArr,sw,iTypppArr;
1031 std::vector<int> stdvecTyyppArr;
1032 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1033 self->renumberNodes(tmp,newNbOfNodes);
1036 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1038 int szArr,sw,iTypppArr;
1039 std::vector<int> stdvecTyyppArr;
1040 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1041 self->renumberNodes2(tmp,newNbOfNodes);
1044 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1046 int spaceDim=self->getSpaceDimension();
1048 DataArrayDouble *a,*a2;
1049 DataArrayDoubleTuple *aa,*aa2;
1050 std::vector<double> bb,bb2;
1052 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1053 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1054 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1055 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1056 std::vector<int> nodes;
1057 self->findNodesOnLine(p,v,eps,nodes);
1058 DataArrayInt *ret=DataArrayInt::New();
1059 ret->alloc((int)nodes.size(),1);
1060 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1061 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1063 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1065 int spaceDim=self->getSpaceDimension();
1067 DataArrayDouble *a,*a2;
1068 DataArrayDoubleTuple *aa,*aa2;
1069 std::vector<double> bb,bb2;
1071 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1072 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1073 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1074 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1075 std::vector<int> nodes;
1076 self->findNodesOnPlane(p,v,eps,nodes);
1077 DataArrayInt *ret=DataArrayInt::New();
1078 ret->alloc((int)nodes.size(),1);
1079 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1080 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1083 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1087 DataArrayDoubleTuple *aa;
1088 std::vector<double> bb;
1090 int spaceDim=self->getSpaceDimension();
1091 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1092 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1093 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1094 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1097 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1099 DataArrayInt *c=0,*cI=0;
1103 DataArrayDoubleTuple *aa;
1104 std::vector<double> bb;
1106 int spaceDim=self->getSpaceDimension();
1107 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1108 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1109 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1110 PyObject *ret=PyTuple_New(2);
1111 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1112 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1116 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1118 DataArrayInt *c=0,*cI=0;
1119 int spaceDim=self->getSpaceDimension();
1122 DataArrayDoubleTuple *aa;
1123 std::vector<double> bb;
1126 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1127 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1129 PyObject *ret=PyTuple_New(2);
1130 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1131 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1135 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1139 DataArrayDoubleTuple *aa;
1140 std::vector<double> bb;
1142 int spaceDim=self->getSpaceDimension();
1143 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1144 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1146 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1147 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1150 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1154 std::vector<int> multiVal;
1155 std::pair<int, std::pair<int,int> > slic;
1156 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1157 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1161 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1163 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1165 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1167 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1171 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
1173 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
1174 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
1175 self->getReverseNodalConnectivity(d0,d1);
1176 PyObject *ret=PyTuple_New(2);
1177 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1178 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1182 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1184 DataArrayInt *v0=0,*v1=0;
1185 self->findCommonCells(compType,startCellId,v0,v1);
1186 PyObject *res = PyList_New(2);
1187 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1188 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1193 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1196 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1197 if (!SWIG_IsOK(res1))
1200 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1201 self->renumberNodesInConn(tmp);
1205 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1207 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1208 da2->checkAllocated();
1209 self->renumberNodesInConn(da2->getConstPointer());
1213 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1216 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1217 PyObject *ret=PyTuple_New(2);
1218 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1219 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1223 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1225 DataArrayInt *ret=0;
1227 int szArr,sw,iTypppArr;
1228 std::vector<int> stdvecTyyppArr;
1229 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1230 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1234 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1238 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1239 PyObject *res = PyList_New(3);
1240 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1241 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1242 PyList_SetItem(res,2,SWIG_From_int(ret2));
1246 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1250 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1251 PyObject *res = PyList_New(3);
1252 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1253 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1254 PyList_SetItem(res,2,SWIG_From_int(ret2));
1258 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1261 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1262 if (!SWIG_IsOK(res1))
1265 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1266 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1270 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1272 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1273 da2->checkAllocated();
1274 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1278 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1282 std::vector<int> multiVal;
1283 std::pair<int, std::pair<int,int> > slic;
1284 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1285 int nbc=self->getNumberOfCells();
1286 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1293 std::ostringstream oss;
1294 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1295 throw INTERP_KERNEL::Exception(oss.str().c_str());
1298 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1303 int tmp=nbc+singleVal;
1304 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1308 std::ostringstream oss;
1309 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1310 throw INTERP_KERNEL::Exception(oss.str().c_str());
1316 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1320 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1325 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1326 daIntTyypp->checkAllocated();
1327 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1330 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1334 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1337 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1338 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1339 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1340 for(int i=0;i<sz;i++)
1341 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1344 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1347 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1349 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1350 std::vector<double> val3;
1351 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1352 "Rotate2DAlg",2,true,nbNodes);
1354 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1355 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1358 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1361 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1362 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1363 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1364 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1365 for(int i=0;i<sz;i++)
1366 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1369 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1372 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1374 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1375 std::vector<double> val3;
1376 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1377 "Rotate3DAlg",3,true,nbNodes);
1379 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1380 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1381 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1386 //== MEDCouplingPointSet End
1388 class MEDCouplingUMeshCell
1391 INTERP_KERNEL::NormalizedCellType getType() const;
1394 std::string __str__() const throw(INTERP_KERNEL::Exception)
1396 return self->repr();
1399 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1402 const int *r=self->getAllConn(ret2);
1403 PyObject *ret=PyTuple_New(ret2);
1404 for(int i=0;i<ret2;i++)
1405 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1411 class MEDCouplingUMeshCellIterator
1418 MEDCouplingUMeshCell *ret=self->nextt();
1420 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1423 PyErr_SetString(PyExc_StopIteration,"No more data.");
1430 class MEDCouplingUMeshCellByTypeIterator
1433 ~MEDCouplingUMeshCellByTypeIterator();
1438 MEDCouplingUMeshCellEntry *ret=self->nextt();
1440 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1443 PyErr_SetString(PyExc_StopIteration,"No more data.");
1450 class MEDCouplingUMeshCellByTypeEntry
1453 ~MEDCouplingUMeshCellByTypeEntry();
1456 MEDCouplingUMeshCellByTypeIterator *__iter__()
1458 return self->iterator();
1463 class MEDCouplingUMeshCellEntry
1466 INTERP_KERNEL::NormalizedCellType getType() const;
1467 int getNumberOfElems() const;
1470 MEDCouplingUMeshCellIterator *__iter__()
1472 return self->iterator();
1477 //== MEDCouplingUMesh
1479 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1482 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1483 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1484 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1485 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1486 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1487 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1488 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1489 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1490 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1491 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1492 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1493 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1494 void computeTypes() throw(INTERP_KERNEL::Exception);
1495 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1496 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1498 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1499 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1500 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1501 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1502 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1503 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1504 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1505 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1506 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1507 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1508 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1509 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1510 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1511 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1512 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1513 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1514 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1515 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1516 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1517 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1518 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1519 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1520 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1521 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1522 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1523 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1524 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1525 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1526 DataArrayDouble *computePlaneEquationOf3DFaces() const throw(INTERP_KERNEL::Exception);
1527 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1528 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1529 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1530 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1531 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1532 DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1533 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1534 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1535 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1536 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1537 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1539 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1541 return MEDCouplingUMesh::New();
1544 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1546 return MEDCouplingUMesh::New(meshName,meshDim);
1549 std::string __str__() const throw(INTERP_KERNEL::Exception)
1551 return self->simpleRepr();
1554 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1556 std::ostringstream oss;
1557 self->reprQuickOverview(oss);
1561 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1563 return self->cellIterator();
1566 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1570 std::vector<int> multiVal;
1571 std::pair<int, std::pair<int,int> > slic;
1572 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1573 int nbc=self->getNumberOfCells();
1574 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1581 std::ostringstream oss;
1582 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1583 throw INTERP_KERNEL::Exception(oss.str().c_str());
1587 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1594 int tmp=nbc+singleVal;
1595 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1600 std::ostringstream oss;
1601 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1602 throw INTERP_KERNEL::Exception(oss.str().c_str());
1608 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1614 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1615 daIntTyypp->checkAllocated();
1616 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1620 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1624 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1628 std::vector<int> multiVal;
1629 std::pair<int, std::pair<int,int> > slic;
1630 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1631 int nbc=self->getNumberOfCells();
1632 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1639 std::ostringstream oss;
1640 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1641 throw INTERP_KERNEL::Exception(oss.str().c_str());
1645 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1652 int tmp=nbc+singleVal;
1653 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1658 std::ostringstream oss;
1659 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1660 throw INTERP_KERNEL::Exception(oss.str().c_str());
1666 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1671 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1677 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1678 daIntTyypp->checkAllocated();
1679 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1683 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1687 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1689 int szArr,sw,iTypppArr;
1690 std::vector<int> stdvecTyyppArr;
1691 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1694 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1695 throw INTERP_KERNEL::Exception(oss.str().c_str());
1697 self->insertNextCell(type,size,tmp);
1700 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1702 int szArr,sw,iTypppArr;
1703 std::vector<int> stdvecTyyppArr;
1704 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1705 self->insertNextCell(type,szArr,tmp);
1708 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1710 DataArrayInt *ret=self->getNodalConnectivity();
1715 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1717 DataArrayInt *ret=self->getNodalConnectivityIndex();
1722 PyObject *getAllTypes() const throw(INTERP_KERNEL::Exception)
1724 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllTypes();
1725 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1726 PyObject *res = PyList_New(result.size());
1727 for (int i=0;iL!=result.end(); i++, iL++)
1728 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1732 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1734 int szArr,sw,iTypppArr;
1735 std::vector<int> stdvecTyyppArr;
1736 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1737 int nbOfDepthPeelingPerformed=0;
1738 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1739 PyObject *res=PyTuple_New(2);
1740 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1741 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1745 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1747 DataArrayInt *v0=0,*v1=0;
1748 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1749 PyObject *res = PyList_New(2);
1750 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1751 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1755 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1759 DataArrayDoubleTuple *aa;
1760 std::vector<double> bb;
1762 int nbOfCompo=self->getSpaceDimension();
1763 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1766 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1767 PyObject *ret=PyTuple_New(2);
1768 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1769 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1773 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1775 DataArrayInt *ret1=0;
1776 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1777 PyObject *ret=PyTuple_New(2);
1778 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1779 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1783 PyObject *tetrahedrize(int policy) throw(INTERP_KERNEL::Exception)
1786 DataArrayInt *ret1(0);
1787 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
1788 PyObject *ret=PyTuple_New(3);
1789 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
1790 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1791 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
1795 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1797 std::vector<int> cells;
1798 self->checkButterflyCells(cells,eps);
1799 DataArrayInt *ret=DataArrayInt::New();
1800 ret->alloc((int)cells.size(),1);
1801 std::copy(cells.begin(),cells.end(),ret->getPointer());
1802 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1805 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1807 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1809 PyObject *ret = PyList_New(sz);
1810 for(int i=0;i<sz;i++)
1811 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1815 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1817 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1818 int sz=retCpp.size();
1819 PyObject *ret=PyList_New(sz);
1820 for(int i=0;i<sz;i++)
1821 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1825 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1828 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1829 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1830 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1833 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1836 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1837 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1841 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1844 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1845 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1849 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1851 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1852 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1853 PyObject *ret=PyTuple_New(3);
1854 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1855 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1856 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1860 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1862 DataArrayInt *tmp0=0,*tmp1=0;
1863 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1864 PyObject *ret=PyTuple_New(2);
1865 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1866 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1870 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1874 std::vector<int> multiVal;
1875 std::pair<int, std::pair<int,int> > slic;
1876 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1877 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1881 return self->duplicateNodes(&singleVal,&singleVal+1);
1883 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
1885 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
1887 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1891 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
1895 std::vector<int> multiVal;
1896 std::pair<int, std::pair<int,int> > slic;
1897 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1898 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1902 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
1904 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
1906 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
1908 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1912 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
1915 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1916 DataArrayInt *tmp0,*tmp1=0;
1917 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
1918 PyObject *ret=PyTuple_New(2);
1919 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1920 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1924 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const throw(INTERP_KERNEL::Exception)
1926 DataArrayInt *ret0=0,*ret1=0;
1927 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
1928 PyObject *ret=PyTuple_New(2);
1929 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1930 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1934 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1936 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1937 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1938 DataArrayInt *ret1=0,*ret2=0;
1939 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
1940 PyObject *ret=PyTuple_New(3);
1941 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1942 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1943 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1947 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1949 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1950 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1951 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
1952 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1955 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
1958 std::vector<const MEDCouplingUMesh *> meshes;
1959 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1960 std::vector<DataArrayInt *> corr;
1961 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
1963 PyObject *ret1=PyList_New(sz);
1964 for(int i=0;i<sz;i++)
1965 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1966 PyObject *ret=PyList_New(2);
1967 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1968 PyList_SetItem(ret,1,ret1);
1972 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1974 std::vector<MEDCouplingUMesh *> meshes;
1975 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1976 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
1979 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
1981 std::vector<MEDCouplingUMesh *> meshes;
1982 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1983 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
1986 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
1990 std::vector<int> multiVal;
1991 std::pair<int, std::pair<int,int> > slic;
1992 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1994 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
1995 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
1999 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2001 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2003 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2005 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2009 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2011 DataArrayInt *arrOut=0,*arrIndexOut=0;
2014 std::vector<int> multiVal;
2015 std::pair<int, std::pair<int,int> > slic;
2016 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2018 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2019 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2024 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2029 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2034 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2038 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2040 PyObject *ret=PyTuple_New(2);
2041 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2042 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2046 static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2048 DataArrayInt *arrOut=0,*arrIndexOut=0;
2049 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2050 PyObject *ret=PyTuple_New(2);
2051 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2052 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2056 static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2058 if(!PySlice_Check(slic))
2059 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !");
2060 Py_ssize_t strt=2,stp=2,step=2;
2061 PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
2063 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !");
2064 arrIndxIn->checkAllocated();
2065 if(arrIndxIn->getNumberOfComponents()!=1)
2066 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !");
2067 if(PySlice_GetIndices(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step)!=0)
2068 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !");
2069 DataArrayInt *arrOut=0,*arrIndexOut=0;
2070 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2071 PyObject *ret=PyTuple_New(2);
2072 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2073 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2077 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2078 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2079 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2081 DataArrayInt *arrOut=0,*arrIndexOut=0;
2084 std::vector<int> multiVal;
2085 std::pair<int, std::pair<int,int> > slic;
2086 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2088 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2089 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2094 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2099 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2104 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2108 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2110 PyObject *ret=PyTuple_New(2);
2111 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2112 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2116 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2117 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2121 std::vector<int> multiVal;
2122 std::pair<int, std::pair<int,int> > slic;
2123 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2125 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2126 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2131 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2136 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2141 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2145 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2149 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2153 DataArrayDoubleTuple *aa;
2154 std::vector<double> bb;
2156 int spaceDim=self->getSpaceDimension();
2157 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2158 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2160 std::vector<int> cells;
2161 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2162 DataArrayInt *ret=DataArrayInt::New();
2163 ret->alloc((int)cells.size(),1);
2164 std::copy(cells.begin(),cells.end(),ret->getPointer());
2165 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2168 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2172 DataArrayDoubleTuple *aa;
2173 std::vector<double> bb;
2175 int spaceDim=self->getSpaceDimension();
2176 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2177 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2178 self->orientCorrectly2DCells(v,polyOnly);
2181 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2183 std::vector<int> cells;
2184 self->arePolyhedronsNotCorrectlyOriented(cells);
2185 DataArrayInt *ret=DataArrayInt::New();
2186 ret->alloc((int)cells.size(),1);
2187 std::copy(cells.begin(),cells.end(),ret->getPointer());
2188 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2191 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2195 self->getFastAveragePlaneOfThis(vec,pos);
2197 std::copy(vec,vec+3,vals);
2198 std::copy(pos,pos+3,vals+3);
2199 return convertDblArrToPyListOfTuple(vals,3,2);
2202 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2204 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2205 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2206 return MEDCouplingUMesh::MergeUMeshes(tmp);
2209 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2212 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2213 PyObject *ret=PyTuple_New(2);
2214 PyObject *ret0Py=ret0?Py_True:Py_False;
2216 PyTuple_SetItem(ret,0,ret0Py);
2217 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2221 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2224 bool ret0=self->areCellsIncludedIn2(other,ret1);
2225 PyObject *ret=PyTuple_New(2);
2226 PyObject *ret0Py=ret0?Py_True:Py_False;
2228 PyTuple_SetItem(ret,0,ret0Py);
2229 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2233 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2235 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2236 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2237 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2238 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2239 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2240 PyObject *ret=PyTuple_New(5);
2241 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2242 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2243 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2244 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2245 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2249 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2251 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2252 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2253 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2254 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2255 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2256 PyObject *ret=PyTuple_New(5);
2257 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2258 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2259 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2260 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2261 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2265 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2267 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2268 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2269 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2270 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2271 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2272 PyObject *ret=PyTuple_New(5);
2273 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2274 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2275 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2276 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2277 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2281 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2283 DataArrayInt *neighbors=0,*neighborsIdx=0;
2284 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2285 PyObject *ret=PyTuple_New(2);
2286 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2287 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2291 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2293 DataArrayInt *neighbors=0,*neighborsIdx=0;
2294 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2295 PyObject *ret=PyTuple_New(2);
2296 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2297 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2301 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2303 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2304 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2305 DataArrayInt *d2,*d3,*d4,*dd5;
2306 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2307 PyObject *ret=PyTuple_New(7);
2308 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2309 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2310 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2311 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2312 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2313 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2314 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2318 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2321 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2322 da->checkAllocated();
2323 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2326 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2329 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2330 da->checkAllocated();
2331 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2334 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2337 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2338 da->checkAllocated();
2339 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2342 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2345 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2346 da->checkAllocated();
2347 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2348 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2349 PyObject *res = PyList_New(result.size());
2350 for (int i=0;iL!=result.end(); i++, iL++)
2351 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2355 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2358 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2359 da->checkAllocated();
2360 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2361 ret->setName(da->getName().c_str());
2365 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2367 DataArrayInt *cellNb1=0,*cellNb2=0;
2368 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2369 PyObject *ret=PyTuple_New(3);
2370 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2371 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2372 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2376 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2378 int spaceDim=self->getSpaceDimension();
2380 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2382 DataArrayDouble *a,*a2;
2383 DataArrayDoubleTuple *aa,*aa2;
2384 std::vector<double> bb,bb2;
2386 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2387 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2388 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2389 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2391 DataArrayInt *cellIds=0;
2392 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2393 PyObject *ret=PyTuple_New(2);
2394 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2395 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2399 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2401 int spaceDim=self->getSpaceDimension();
2403 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2405 DataArrayDouble *a,*a2;
2406 DataArrayDoubleTuple *aa,*aa2;
2407 std::vector<double> bb,bb2;
2409 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2410 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2411 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2412 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2414 DataArrayInt *cellIds=0;
2415 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2416 PyObject *ret=PyTuple_New(2);
2417 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2418 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2422 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2424 int spaceDim=self->getSpaceDimension();
2426 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2428 DataArrayDouble *a,*a2;
2429 DataArrayDoubleTuple *aa,*aa2;
2430 std::vector<double> bb,bb2;
2432 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2433 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2434 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2435 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2436 return self->getCellIdsCrossingPlane(orig,vect,eps);
2439 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2443 std::vector<int> pos2;
2444 DataArrayInt *pos3=0;
2445 DataArrayIntTuple *pos4=0;
2446 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2451 self->convertToPolyTypes(&pos1,&pos1+1);
2458 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2463 self->convertToPolyTypes(pos3->begin(),pos3->end());
2467 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2471 void convertAllToPoly();
2472 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2473 bool unPolyze() throw(INTERP_KERNEL::Exception);
2474 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2475 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2476 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2479 //== MEDCouplingUMesh End
2481 //== MEDCouplingExtrudedMesh
2483 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2486 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2487 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2489 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2491 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2494 std::string __str__() const throw(INTERP_KERNEL::Exception)
2496 return self->simpleRepr();
2499 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2501 std::ostringstream oss;
2502 self->reprQuickOverview(oss);
2506 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2508 MEDCouplingUMesh *ret=self->getMesh2D();
2511 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2513 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2515 MEDCouplingUMesh *ret=self->getMesh1D();
2518 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2520 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2522 DataArrayInt *ret=self->getMesh3DIds();
2525 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2530 //== MEDCouplingExtrudedMesh End
2532 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2535 static MEDCoupling1GTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2536 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2537 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2538 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2539 virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2540 virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
2543 virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2545 int szArr,sw,iTypppArr;
2546 std::vector<int> stdvecTyyppArr;
2547 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2548 self->insertNextCell(tmp,tmp+szArr);
2551 virtual DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2553 DataArrayInt *ret=self->getNodalConnectivity();
2554 if(ret) ret->incrRef();
2558 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2560 std::vector< const MEDCoupling1GTUMesh *> parts;
2561 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
2562 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
2567 //== MEDCoupling1SGTUMesh
2569 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2572 static MEDCoupling1SGTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2573 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2574 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2575 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2576 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2577 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2578 MEDCoupling1GTUMesh *computeDualMesh() const throw(INTERP_KERNEL::Exception);
2579 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const throw(INTERP_KERNEL::Exception);
2580 DataArrayInt *sortHexa8EachOther() throw(INTERP_KERNEL::Exception);
2583 MEDCoupling1SGTUMesh(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2585 return MEDCoupling1SGTUMesh::New(name,type);
2588 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2590 return MEDCoupling1SGTUMesh::New(m);
2593 std::string __str__() const throw(INTERP_KERNEL::Exception)
2595 return self->simpleRepr();
2598 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2600 std::ostringstream oss;
2601 self->reprQuickOverview(oss);
2605 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2607 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2608 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2609 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2612 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2614 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2615 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2616 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2621 //== MEDCoupling1SGTUMesh End
2623 //== MEDCoupling1DGTUMesh
2625 class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2628 static MEDCoupling1DGTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2629 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2630 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
2631 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2632 bool isPacked() const throw(INTERP_KERNEL::Exception);
2635 MEDCoupling1DGTUMesh(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2637 return MEDCoupling1DGTUMesh::New(name,type);
2640 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2642 return MEDCoupling1DGTUMesh::New(m);
2645 std::string __str__() const throw(INTERP_KERNEL::Exception)
2647 return self->simpleRepr();
2650 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2652 std::ostringstream oss;
2653 self->reprQuickOverview(oss);
2657 DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
2659 DataArrayInt *ret=self->getNodalConnectivityIndex();
2660 if(ret) ret->incrRef();
2664 PyObject *retrievePackedNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2666 DataArrayInt *ret1=0,*ret2=0;
2667 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
2668 PyObject *ret0Py=ret0?Py_True:Py_False;
2670 PyObject *ret=PyTuple_New(3);
2671 PyTuple_SetItem(ret,0,ret0Py);
2672 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2673 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2677 PyObject *copyWithNodalConnectivityPacked() const throw(INTERP_KERNEL::Exception)
2680 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
2681 PyObject *ret=PyTuple_New(2);
2682 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
2683 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
2684 PyTuple_SetItem(ret,1,ret1Py);
2688 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2690 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2691 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2692 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
2695 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2697 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2698 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2699 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
2702 static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt) throw(INTERP_KERNEL::Exception)
2704 std::vector<const ParaMEDMEM::DataArrayInt *> tmp;
2705 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2706 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
2711 //== MEDCoupling1DGTUMeshEnd
2713 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2716 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2717 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2718 virtual std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2719 std::vector<int> getCellGridStructure() const throw(INTERP_KERNEL::Exception);
2720 MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception);
2721 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
2724 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const throw(INTERP_KERNEL::Exception)
2726 int tmpp1=-1,tmpp2=-1;
2727 std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
2728 std::vector< std::pair<int,int> > inp;
2732 for(int i=0;i<tmpp1;i++)
2733 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2738 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
2739 inp.resize(tmpp1/2);
2740 for(int i=0;i<tmpp1/2;i++)
2741 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2744 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
2745 return self->buildStructuredSubPart(inp);
2748 static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) throw(INTERP_KERNEL::Exception)
2750 int tmpp1=-1,tmpp2=-1;
2751 std::vector<int> tmp=fillArrayWithPyListInt2(part,tmpp1,tmpp2);
2752 std::vector< std::pair<int,int> > inp;
2756 for(int i=0;i<tmpp1;i++)
2757 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2762 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.BuildExplicitIdsFrom : invalid input size ! Must be even size !");
2763 inp.resize(tmpp1/2);
2764 for(int i=0;i<tmpp1/2;i++)
2765 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2768 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.BuildExplicitIdsFrom : invalid input size !");
2770 int szArr,sw,iTypppArr;
2771 std::vector<int> stdvecTyyppArr;
2772 const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
2773 std::vector<int> tmp5(tmp4,tmp4+szArr);
2775 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
2778 static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) throw(INTERP_KERNEL::Exception)
2780 int szArr,sw,iTypppArr;
2781 std::vector<int> stdvecTyyppArr;
2782 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2783 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
2786 static PyObject *IsPartStructured(PyObject *li, PyObject *st) throw(INTERP_KERNEL::Exception)
2788 int szArr,sw,iTypppArr;
2789 std::vector<int> stdvecTyyppArr;
2790 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2791 int szArr2,sw2,iTypppArr2;
2792 std::vector<int> stdvecTyyppArr2;
2793 const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
2794 std::vector<int> tmp3(tmp2,tmp2+szArr2);
2795 std::vector< std::pair<int,int> > partCompactFormat;
2796 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
2797 PyObject *ret=PyTuple_New(2);
2798 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
2799 PyTuple_SetItem(ret,0,ret0Py);
2800 PyObject *ret1Py=PyList_New(partCompactFormat.size());
2801 for(std::size_t i=0;i<partCompactFormat.size();i++)
2803 PyObject *tmp4=PyTuple_New(2);
2804 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
2805 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
2806 PyList_SetItem(ret1Py,i,tmp4);
2808 PyTuple_SetItem(ret,1,ret1Py);
2814 //== MEDCouplingCMesh
2816 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2819 static MEDCouplingCMesh *New();
2820 static MEDCouplingCMesh *New(const char *meshName);
2821 MEDCouplingCMesh *clone(bool recDeepCpy) const;
2822 void setCoords(const DataArrayDouble *coordsX,
2823 const DataArrayDouble *coordsY=0,
2824 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
2825 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
2829 return MEDCouplingCMesh::New();
2831 MEDCouplingCMesh(const char *meshName)
2833 return MEDCouplingCMesh::New(meshName);
2835 std::string __str__() const throw(INTERP_KERNEL::Exception)
2837 return self->simpleRepr();
2839 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2841 std::ostringstream oss;
2842 self->reprQuickOverview(oss);
2845 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
2847 DataArrayDouble *ret=self->getCoordsAt(i);
2855 //== MEDCouplingCMesh End
2857 //== MEDCouplingCurveLinearMesh
2859 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2862 static MEDCouplingCurveLinearMesh *New();
2863 static MEDCouplingCurveLinearMesh *New(const char *meshName);
2864 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
2865 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
2867 MEDCouplingCurveLinearMesh()
2869 return MEDCouplingCurveLinearMesh::New();
2871 MEDCouplingCurveLinearMesh(const char *meshName)
2873 return MEDCouplingCurveLinearMesh::New(meshName);
2875 std::string __str__() const throw(INTERP_KERNEL::Exception)
2877 return self->simpleRepr();
2879 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2881 std::ostringstream oss;
2882 self->reprQuickOverview(oss);
2885 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
2887 DataArrayDouble *ret=self->getCoords();
2892 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
2894 int szArr,sw,iTypppArr;
2895 std::vector<int> stdvecTyyppArr;
2896 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
2897 self->setNodeGridStructure(tmp,tmp+szArr);
2902 //== MEDCouplingCurveLinearMesh End
2905 namespace ParaMEDMEM
2907 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
2910 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
2911 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
2912 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2913 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2914 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
2915 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
2916 void setName(const char *name) throw(INTERP_KERNEL::Exception);
2917 std::string getDescription() const throw(INTERP_KERNEL::Exception);
2918 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
2919 std::string getName() const throw(INTERP_KERNEL::Exception);
2920 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
2921 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
2922 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
2923 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
2924 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
2925 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
2926 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
2927 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
2928 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
2929 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
2930 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
2931 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
2932 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
2933 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
2934 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
2935 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
2937 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
2939 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
2942 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
2945 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
2947 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
2950 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
2953 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
2955 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
2956 return convertIntArrToPyList3(ret);
2959 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
2962 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
2963 PyObject *ret=PyTuple_New(2);
2964 PyObject *ret0Py=ret0?Py_True:Py_False;
2966 PyTuple_SetItem(ret,0,ret0Py);
2967 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2971 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
2973 DataArrayInt *ret1=0;
2974 MEDCouplingMesh *ret0=0;
2976 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2977 if (!SWIG_IsOK(res1))
2980 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2981 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
2985 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2987 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2988 da2->checkAllocated();
2989 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
2991 PyObject *res = PyList_New(2);
2992 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
2993 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2997 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
2999 DataArrayInt *ret1=0;
3001 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3002 PyObject *res=PyTuple_New(2);
3003 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3005 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3008 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3009 PyTuple_SetItem(res,1,res1);
3014 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3017 int v0; std::vector<int> v1;
3018 const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
3019 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3022 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3023 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3026 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3027 if (!SWIG_IsOK(res1))
3030 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3031 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3035 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3037 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3038 da2->checkAllocated();
3039 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3043 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3045 std::vector<int> tmp;
3046 self->getCellIdsHavingGaussLocalization(locId,tmp);
3047 DataArrayInt *ret=DataArrayInt::New();
3048 ret->alloc((int)tmp.size(),1);
3049 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3050 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3053 int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
3055 std::vector<int> inp0;
3056 convertPyToNewIntArr4(code,1,3,inp0);
3057 std::vector<const DataArrayInt *> inp1;
3058 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(idsPerType,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",inp1);
3059 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3064 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3067 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3068 static MEDCouplingFieldTemplate *New(TypeOfField type);
3069 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3070 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3073 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3075 return MEDCouplingFieldTemplate::New(f);
3078 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3080 return MEDCouplingFieldTemplate::New(type);
3083 std::string __str__() const throw(INTERP_KERNEL::Exception)
3085 return self->simpleRepr();
3088 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3090 std::ostringstream oss;
3091 self->reprQuickOverview(oss);
3097 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3100 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3101 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3102 void setTimeUnit(const char *unit);
3103 const char *getTimeUnit() const;
3104 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3105 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3106 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3107 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3108 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3109 void writeVTK(const char *fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
3110 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3111 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3112 MEDCouplingFieldDouble *deepCpy() const;
3113 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3114 MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
3115 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3116 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3117 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3118 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3119 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3120 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3121 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3122 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3123 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3124 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3125 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3126 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3127 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3128 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3129 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3130 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3131 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3132 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3133 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3134 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3135 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3136 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3137 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3138 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3139 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3140 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3141 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3142 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3143 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3144 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3145 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3146 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3147 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3148 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3149 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3150 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3151 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3152 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3153 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3154 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3155 void fillFromAnalytic(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3156 void fillFromAnalytic2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3157 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
3158 void applyFunc(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3159 void applyFunc2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3160 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
3161 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3162 void applyFunc(const char *func) throw(INTERP_KERNEL::Exception);
3163 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
3164 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
3165 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3166 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3167 double getMinValue() const throw(INTERP_KERNEL::Exception);
3168 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3169 double norm2() const throw(INTERP_KERNEL::Exception);
3170 double normMax() const throw(INTERP_KERNEL::Exception);
3171 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3172 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3173 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3174 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3175 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3176 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3177 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3178 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3179 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3180 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3181 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3182 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3183 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3184 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3185 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3186 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3187 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3188 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3189 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3190 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3191 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3192 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3194 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3196 return MEDCouplingFieldDouble::New(type,td);
3199 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3201 return MEDCouplingFieldDouble::New(ft,td);
3204 std::string __str__() const throw(INTERP_KERNEL::Exception)
3206 return self->simpleRepr();
3209 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3211 std::ostringstream oss;
3212 self->reprQuickOverview(oss);
3216 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3218 DataArrayDouble *ret=self->getArray();
3224 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3226 std::vector<DataArrayDouble *> arrs=self->getArrays();
3227 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3231 PyObject *ret=PyTuple_New(sz);
3232 for(int i=0;i<sz;i++)
3235 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3237 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3242 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3244 std::vector<const DataArrayDouble *> tmp;
3245 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3247 std::vector<DataArrayDouble *> arrs(sz);
3248 for(int i=0;i<sz;i++)
3249 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3250 self->setArrays(arrs);
3253 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3255 DataArrayDouble *ret=self->getEndArray();
3261 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3265 DataArrayDoubleTuple *aa;
3266 std::vector<double> bb;
3268 const MEDCouplingMesh *mesh=self->getMesh();
3270 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3271 int spaceDim=mesh->getSpaceDimension();
3272 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3273 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3275 int sz=self->getNumberOfComponents();
3276 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3277 self->getValueOn(spaceLoc,res);
3278 return convertDblArrToPyList(res,sz);
3281 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3283 int sz=self->getNumberOfComponents();
3284 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3285 self->getValueOnPos(i,j,k,res);
3286 return convertDblArrToPyList(res,sz);
3289 DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
3291 const MEDCouplingMesh *mesh(self->getMesh());
3293 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3296 double v0; ParaMEDMEM::DataArrayDouble *v1(0); ParaMEDMEM::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
3297 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
3298 mesh->getSpaceDimension(),true,nbPts);
3299 return self->getValueOnMulti(inp,nbPts);
3302 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3306 DataArrayDoubleTuple *aa;
3307 std::vector<double> bb;
3309 const MEDCouplingMesh *mesh=self->getMesh();
3311 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3312 int spaceDim=mesh->getSpaceDimension();
3313 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3314 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3317 int sz=self->getNumberOfComponents();
3318 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3319 self->getValueOn(spaceLoc,time,res);
3320 return convertDblArrToPyList(res,sz);
3323 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3325 if(self->getArray()!=0)
3326 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3329 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3330 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3331 self->setArray(arr);
3335 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3338 double tmp0=self->getTime(tmp1,tmp2);
3339 PyObject *res = PyList_New(3);
3340 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3341 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3342 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3346 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3349 double tmp0=self->getStartTime(tmp1,tmp2);
3350 PyObject *res = PyList_New(3);
3351 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3352 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3353 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3357 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3360 double tmp0=self->getEndTime(tmp1,tmp2);
3361 PyObject *res = PyList_New(3);
3362 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3363 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3364 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3367 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3369 int sz=self->getNumberOfComponents();
3370 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3371 self->accumulate(tmp);
3372 return convertDblArrToPyList(tmp,sz);
3374 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3376 int sz=self->getNumberOfComponents();
3377 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3378 self->integral(isWAbs,tmp);
3379 return convertDblArrToPyList(tmp,sz);
3381 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3383 int sz=self->getNumberOfComponents();
3384 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3385 self->getWeightedAverageValue(tmp,isWAbs);
3386 return convertDblArrToPyList(tmp,sz);
3388 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3390 int sz=self->getNumberOfComponents();
3391 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3393 return convertDblArrToPyList(tmp,sz);
3395 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3397 int sz=self->getNumberOfComponents();
3398 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3400 return convertDblArrToPyList(tmp,sz);
3402 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3404 int szArr,sw,iTypppArr;
3405 std::vector<int> stdvecTyyppArr;
3406 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3407 self->renumberCells(tmp,check);
3410 void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3412 int szArr,sw,iTypppArr;
3413 std::vector<int> stdvecTyyppArr;
3414 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3415 self->renumberCellsWithoutMesh(tmp,check);
3418 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3420 int szArr,sw,iTypppArr;
3421 std::vector<int> stdvecTyyppArr;
3422 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3423 self->renumberNodes(tmp,eps);
3426 void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3428 int szArr,sw,iTypppArr;
3429 std::vector<int> stdvecTyyppArr;
3430 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3431 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
3434 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3438 std::vector<int> multiVal;
3439 std::pair<int, std::pair<int,int> > slic;
3440 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3441 const MEDCouplingMesh *mesh=self->getMesh();
3443 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3444 int nbc=mesh->getNumberOfCells();
3445 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3452 std::ostringstream oss;
3453 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3454 throw INTERP_KERNEL::Exception(oss.str().c_str());
3457 return self->buildSubPart(&singleVal,&singleVal+1);
3462 int tmp=nbc+singleVal;
3463 return self->buildSubPart(&tmp,&tmp+1);
3467 std::ostringstream oss;
3468 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3469 throw INTERP_KERNEL::Exception(oss.str().c_str());
3475 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3479 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3484 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3485 daIntTyypp->checkAllocated();
3486 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3489 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3493 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3495 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";
3496 if(PyTuple_Check(li))
3498 Py_ssize_t sz=PyTuple_Size(li);
3500 throw INTERP_KERNEL::Exception(msg);
3501 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3504 std::vector<int> multiVal;
3505 std::pair<int, std::pair<int,int> > slic;
3506 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3507 if(!self->getArray())
3508 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3510 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3511 catch(INTERP_KERNEL::Exception& e)
3512 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3513 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3514 DataArrayDouble *ret0Arr=ret0->getArray();
3516 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3521 std::vector<int> v2(1,singleVal);
3522 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3523 ret0->setArray(aarr);
3528 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3529 ret0->setArray(aarr);
3534 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3535 std::vector<int> v2(nbOfComp);
3536 for(int i=0;i<nbOfComp;i++)
3537 v2[i]=slic.first+i*slic.second.second;
3538 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3539 ret0->setArray(aarr);
3543 throw INTERP_KERNEL::Exception(msg);
3548 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3551 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3554 double r1=self->getMaxValue2(tmp);
3555 PyObject *ret=PyTuple_New(2);
3556 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3557 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3561 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3564 double r1=self->getMinValue2(tmp);
3565 PyObject *ret=PyTuple_New(2);
3566 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3567 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3571 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3573 std::vector<int> tmp;
3574 convertPyToNewIntArr3(li,tmp);
3575 return self->keepSelectedComponents(tmp);
3578 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3580 std::vector<int> tmp;
3581 convertPyToNewIntArr3(li,tmp);
3582 self->setSelectedComponents(f,tmp);
3585 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3588 DataArrayDouble *a,*a2;
3589 DataArrayDoubleTuple *aa,*aa2;
3590 std::vector<double> bb,bb2;
3593 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
3594 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
3595 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3596 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3598 return self->extractSlice3D(orig,vect,eps);
3601 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3603 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
3606 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3608 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
3611 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3613 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.";
3614 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
3617 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3619 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3621 return (*self)-(*other);
3623 throw INTERP_KERNEL::Exception(msg);
3628 DataArrayDoubleTuple *aa;
3629 std::vector<double> bb;
3631 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3636 if(!self->getArray())
3637 throw INTERP_KERNEL::Exception(msg2);
3638 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3639 ret->applyLin(1.,-val);
3640 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3641 ret2->setArray(ret);
3646 if(!self->getArray())
3647 throw INTERP_KERNEL::Exception(msg2);
3648 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
3649 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3650 ret2->setArray(ret);
3655 if(!self->getArray())
3656 throw INTERP_KERNEL::Exception(msg2);
3657 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3658 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3659 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3660 ret2->setArray(ret);
3665 if(!self->getArray())
3666 throw INTERP_KERNEL::Exception(msg2);
3667 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3668 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3669 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3670 ret2->setArray(ret);
3674 { throw INTERP_KERNEL::Exception(msg); }
3678 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3680 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
3683 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3685 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
3688 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3690 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
3693 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3695 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.";
3696 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
3699 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3701 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3703 return (*self)/(*other);
3705 throw INTERP_KERNEL::Exception(msg);
3710 DataArrayDoubleTuple *aa;
3711 std::vector<double> bb;
3713 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3719 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
3720 if(!self->getArray())
3721 throw INTERP_KERNEL::Exception(msg2);
3722 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3723 ret->applyLin(1./val,0);
3724 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3725 ret2->setArray(ret);
3730 if(!self->getArray())
3731 throw INTERP_KERNEL::Exception(msg2);
3732 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
3733 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3734 ret2->setArray(ret);
3739 if(!self->getArray())
3740 throw INTERP_KERNEL::Exception(msg2);
3741 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3742 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3743 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3744 ret2->setArray(ret);
3749 if(!self->getArray())
3750 throw INTERP_KERNEL::Exception(msg2);
3751 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3752 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3753 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3754 ret2->setArray(ret);
3758 { throw INTERP_KERNEL::Exception(msg); }
3762 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3764 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
3767 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3769 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.";
3770 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
3773 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3775 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3777 return (*self)^(*other);
3779 throw INTERP_KERNEL::Exception(msg);
3784 DataArrayDoubleTuple *aa;
3785 std::vector<double> bb;
3787 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3792 if(!self->getArray())
3793 throw INTERP_KERNEL::Exception(msg2);
3794 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3796 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3797 ret2->setArray(ret);
3802 if(!self->getArray())
3803 throw INTERP_KERNEL::Exception(msg2);
3804 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
3805 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3806 ret2->setArray(ret);
3811 if(!self->getArray())
3812 throw INTERP_KERNEL::Exception(msg2);
3813 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3814 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3815 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3816 ret2->setArray(ret);
3821 if(!self->getArray())
3822 throw INTERP_KERNEL::Exception(msg2);
3823 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3824 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3825 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3826 ret2->setArray(ret);
3830 { throw INTERP_KERNEL::Exception(msg); }
3834 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
3836 return self->negate();
3839 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3841 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.";
3842 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
3845 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3847 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3851 Py_XINCREF(trueSelf);
3855 throw INTERP_KERNEL::Exception(msg);
3860 DataArrayDoubleTuple *aa;
3861 std::vector<double> bb;
3863 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3868 if(!self->getArray())
3869 throw INTERP_KERNEL::Exception(msg2);
3870 self->getArray()->applyLin(1.,val);
3871 Py_XINCREF(trueSelf);
3876 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3879 Py_XINCREF(trueSelf);
3884 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3885 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3886 ret2->setArray(aaa);
3888 Py_XINCREF(trueSelf);
3893 if(!self->getArray())
3894 throw INTERP_KERNEL::Exception(msg2);
3895 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3896 self->getArray()->addEqual(aaa);
3897 Py_XINCREF(trueSelf);
3901 { throw INTERP_KERNEL::Exception(msg); }
3905 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3907 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.";
3908 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
3911 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3913 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3917 Py_XINCREF(trueSelf);
3921 throw INTERP_KERNEL::Exception(msg);
3926 DataArrayDoubleTuple *aa;
3927 std::vector<double> bb;
3929 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3934 if(!self->getArray())
3935 throw INTERP_KERNEL::Exception(msg2);
3936 self->getArray()->applyLin(1.,-val);
3937 Py_XINCREF(trueSelf);
3942 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3945 Py_XINCREF(trueSelf);
3950 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3951 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3952 ret2->setArray(aaa);
3954 Py_XINCREF(trueSelf);
3959 if(!self->getArray())
3960 throw INTERP_KERNEL::Exception(msg2);
3961 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3962 self->getArray()->substractEqual(aaa);
3963 Py_XINCREF(trueSelf);
3967 { throw INTERP_KERNEL::Exception(msg); }
3971 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3973 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.";
3974 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
3977 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3979 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3983 Py_XINCREF(trueSelf);
3987 throw INTERP_KERNEL::Exception(msg);
3992 DataArrayDoubleTuple *aa;
3993 std::vector<double> bb;
3995 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4000 if(!self->getArray())
4001 throw INTERP_KERNEL::Exception(msg2);
4002 self->getArray()->applyLin(val,0);
4003 Py_XINCREF(trueSelf);
4008 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4011 Py_XINCREF(trueSelf);
4016 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4017 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4018 ret2->setArray(aaa);
4020 Py_XINCREF(trueSelf);
4025 if(!self->getArray())
4026 throw INTERP_KERNEL::Exception(msg2);
4027 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4028 self->getArray()->multiplyEqual(aaa);
4029 Py_XINCREF(trueSelf);
4033 { throw INTERP_KERNEL::Exception(msg); }
4037 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4039 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.";
4040 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4043 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4045 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4049 Py_XINCREF(trueSelf);
4053 throw INTERP_KERNEL::Exception(msg);
4058 DataArrayDoubleTuple *aa;
4059 std::vector<double> bb;
4061 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4067 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4068 if(!self->getArray())
4069 throw INTERP_KERNEL::Exception(msg2);
4070 self->getArray()->applyLin(1./val,0);
4071 Py_XINCREF(trueSelf);
4076 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4079 Py_XINCREF(trueSelf);
4084 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4085 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4086 ret2->setArray(aaa);
4088 Py_XINCREF(trueSelf);
4093 if(!self->getArray())
4094 throw INTERP_KERNEL::Exception(msg2);
4095 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4096 self->getArray()->divideEqual(aaa);
4097 Py_XINCREF(trueSelf);
4101 { throw INTERP_KERNEL::Exception(msg); }
4105 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4107 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.";
4108 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4111 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4113 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4117 Py_XINCREF(trueSelf);
4121 throw INTERP_KERNEL::Exception(msg);
4126 DataArrayDoubleTuple *aa;
4127 std::vector<double> bb;
4129 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4134 if(!self->getArray())
4135 throw INTERP_KERNEL::Exception(msg2);
4136 self->getArray()->applyPow(val);
4137 Py_XINCREF(trueSelf);
4142 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4145 Py_XINCREF(trueSelf);
4150 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4151 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4152 ret2->setArray(aaa);
4154 Py_XINCREF(trueSelf);
4159 if(!self->getArray())
4160 throw INTERP_KERNEL::Exception(msg2);
4161 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4162 self->getArray()->powEqual(aaa);
4163 Py_XINCREF(trueSelf);
4167 { throw INTERP_KERNEL::Exception(msg); }
4171 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4173 std::vector<const MEDCouplingFieldDouble *> tmp;
4174 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4175 return MEDCouplingFieldDouble::MergeFields(tmp);
4178 static void WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
4180 std::vector<const MEDCouplingFieldDouble *> tmp;
4181 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4182 MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4187 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4190 int getNumberOfFields() const;
4191 MEDCouplingMultiFields *deepCpy() const;
4192 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4193 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4194 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4195 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4196 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4199 std::string __str__() const throw(INTERP_KERNEL::Exception)
4201 return self->simpleRepr();
4203 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4205 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4206 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4208 std::vector<MEDCouplingFieldDouble *> fs(sz);
4209 for(int i=0;i<sz;i++)
4210 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4211 return MEDCouplingMultiFields::New(fs);
4213 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4215 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4216 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4218 std::vector<MEDCouplingFieldDouble *> fs(sz);
4219 for(int i=0;i<sz;i++)
4220 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4221 return MEDCouplingMultiFields::New(fs);
4223 PyObject *getFields() const
4225 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4226 int sz=fields.size();
4227 PyObject *res = PyList_New(sz);
4228 for(int i=0;i<sz;i++)
4232 fields[i]->incrRef();
4233 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4237 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4242 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4244 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4248 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4251 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4253 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4255 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4257 PyObject *res = PyList_New(sz);
4258 for(int i=0;i<sz;i++)
4263 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4267 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4272 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4274 std::vector<int> refs;
4275 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4277 PyObject *res = PyList_New(sz);
4278 for(int i=0;i<sz;i++)
4283 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4287 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4291 PyObject *ret=PyTuple_New(2);
4292 PyTuple_SetItem(ret,0,res);
4293 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4296 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4298 std::vector<DataArrayDouble *> ms=self->getArrays();
4300 PyObject *res = PyList_New(sz);
4301 for(int i=0;i<sz;i++)
4306 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4310 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4315 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4317 std::vector< std::vector<int> > refs;
4318 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4320 PyObject *res = PyList_New(sz);
4321 PyObject *res2 = PyList_New(sz);
4322 for(int i=0;i<sz;i++)
4327 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4331 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4333 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4336 PyObject *ret=PyTuple_New(2);
4337 PyTuple_SetItem(ret,0,res);
4338 PyTuple_SetItem(ret,1,res2);
4344 class MEDCouplingDefinitionTime
4347 MEDCouplingDefinitionTime();
4348 void assign(const MEDCouplingDefinitionTime& other);
4349 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4350 double getTimeResolution() const;
4351 std::vector<double> getHotSpotsTime() const;
4354 std::string __str__() const throw(INTERP_KERNEL::Exception)
4356 std::ostringstream oss;
4357 self->appendRepr(oss);
4361 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4363 int meshId,arrId,arrIdInField,fieldId;
4364 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4365 PyObject *res=PyList_New(4);
4366 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4367 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4368 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4369 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4373 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4375 int meshId,arrId,arrIdInField,fieldId;
4376 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4377 PyObject *res=PyList_New(4);
4378 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4379 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4380 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4381 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4387 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4390 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4391 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4395 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4397 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4398 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4400 std::vector<MEDCouplingFieldDouble *> fs(sz);
4401 for(int i=0;i<sz;i++)
4402 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4403 return MEDCouplingFieldOverTime::New(fs);
4405 std::string __str__() const throw(INTERP_KERNEL::Exception)
4407 return self->simpleRepr();
4409 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4411 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4412 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4414 std::vector<MEDCouplingFieldDouble *> fs(sz);
4415 for(int i=0;i<sz;i++)
4416 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4417 return MEDCouplingFieldOverTime::New(fs);
4425 __filename=os.environ.get('PYTHONSTARTUP')
4426 if __filename and os.path.isfile(__filename):
4427 execfile(__filename)