1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
27 #include "MEDCouplingMemArray.hxx"
28 #include "MEDCouplingUMesh.hxx"
29 #include "MEDCouplingExtrudedMesh.hxx"
30 #include "MEDCouplingCMesh.hxx"
31 #include "MEDCouplingIMesh.hxx"
32 #include "MEDCouplingCurveLinearMesh.hxx"
33 #include "MEDCoupling1GTUMesh.hxx"
34 #include "MEDCouplingField.hxx"
35 #include "MEDCouplingFieldDouble.hxx"
36 #include "MEDCouplingFieldTemplate.hxx"
37 #include "MEDCouplingGaussLocalization.hxx"
38 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
39 #include "MEDCouplingMultiFields.hxx"
40 #include "MEDCouplingFieldOverTime.hxx"
41 #include "MEDCouplingDefinitionTime.hxx"
42 #include "MEDCouplingFieldDiscretization.hxx"
43 #include "MEDCouplingTypemaps.i"
45 #include "InterpKernelAutoPtr.hxx"
47 using namespace ParaMEDMEM;
48 using namespace INTERP_KERNEL;
52 %template(ivec) std::vector<int>;
53 %template(dvec) std::vector<double>;
54 %template(svec) std::vector<std::string>;
57 %typemap(out) ParaMEDMEM::MEDCouplingMesh*
59 $result=convertMesh($1,$owner);
62 %typemap(out) MEDCouplingMesh*
64 $result=convertMesh($1,$owner);
69 %typemap(out) ParaMEDMEM::MEDCouplingPointSet*
71 $result=convertMesh($1,$owner);
74 %typemap(out) MEDCouplingPointSet*
76 $result=convertMesh($1,$owner);
82 %typemap(out) ParaMEDMEM::MEDCoupling1GTUMesh*
84 $result=convertMesh($1,$owner);
87 %typemap(out) MEDCoupling1GTUMesh*
89 $result=convertMesh($1,$owner);
94 %typemap(out) ParaMEDMEM::MEDCouplingStructuredMesh*
96 $result=convertMesh($1,$owner);
99 %typemap(out) MEDCouplingStructuredMesh*
101 $result=convertMesh($1,$owner);
106 %typemap(out) ParaMEDMEM::MEDCouplingFieldDiscretization*
108 $result=convertFieldDiscretization($1,$owner);
111 %typemap(out) MEDCouplingFieldDiscretization*
113 $result=convertFieldDiscretization($1,$owner);
118 %typemap(out) ParaMEDMEM::MEDCouplingMultiFields*
120 $result=convertMultiFields($1,$owner);
123 %typemap(out) MEDCouplingMultiFields*
125 $result=convertMultiFields($1,$owner);
130 %init %{ import_array(); %}
133 %feature("autodoc", "1");
134 %feature("docstring");
136 %newobject ParaMEDMEM::MEDCouplingField::buildMeasureField;
137 %newobject ParaMEDMEM::MEDCouplingField::getLocalizationOfDiscr;
138 %newobject ParaMEDMEM::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
139 %newobject ParaMEDMEM::MEDCouplingFieldDouble::New;
140 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getArray;
141 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getEndArray;
142 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MergeFields;
143 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MeldFields;
144 %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct;
145 %newobject ParaMEDMEM::MEDCouplingFieldDouble::determinant;
146 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenValues;
147 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenVectors;
148 %newobject ParaMEDMEM::MEDCouplingFieldDouble::inverse;
149 %newobject ParaMEDMEM::MEDCouplingFieldDouble::trace;
150 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deviator;
151 %newobject ParaMEDMEM::MEDCouplingFieldDouble::magnitude;
152 %newobject ParaMEDMEM::MEDCouplingFieldDouble::maxPerTuple;
153 %newobject ParaMEDMEM::MEDCouplingFieldDouble::keepSelectedComponents;
154 %newobject ParaMEDMEM::MEDCouplingFieldDouble::extractSlice3D;
155 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DotFields;
156 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dot;
157 %newobject ParaMEDMEM::MEDCouplingFieldDouble::CrossProductFields;
158 %newobject ParaMEDMEM::MEDCouplingFieldDouble::crossProduct;
159 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MaxFields;
160 %newobject ParaMEDMEM::MEDCouplingFieldDouble::max;
161 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MinFields;
162 %newobject ParaMEDMEM::MEDCouplingFieldDouble::AddFields;
163 %newobject ParaMEDMEM::MEDCouplingFieldDouble::SubstractFields;
164 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MultiplyFields;
165 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DivideFields;
166 %newobject ParaMEDMEM::MEDCouplingFieldDouble::min;
167 %newobject ParaMEDMEM::MEDCouplingFieldDouble::negate;
168 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getIdsInRange;
169 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart;
170 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPartRange;
171 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__getitem__;
172 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__neg__;
173 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__add__;
174 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__sub__;
175 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__mul__;
176 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__div__;
177 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__pow__;
178 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__radd__;
179 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rsub__;
180 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rmul__;
181 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rdiv__;
182 %newobject ParaMEDMEM::MEDCouplingFieldDouble::clone;
183 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cloneWithMesh;
184 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy;
185 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
186 %newobject ParaMEDMEM::MEDCouplingFieldDouble::nodeToCellDiscretization;
187 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cellToNodeDiscretization;
188 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
189 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
190 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
191 %newobject ParaMEDMEM::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
192 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
193 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfNodesPerCell;
194 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfFacesPerCell;
195 %newobject ParaMEDMEM::MEDCouplingMesh::computeEffectiveNbOfNodesPerCell;
196 %newobject ParaMEDMEM::MEDCouplingMesh::buildPartRange;
197 %newobject ParaMEDMEM::MEDCouplingMesh::giveCellsWithType;
198 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
199 %newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
200 %newobject ParaMEDMEM::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
201 %newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
202 %newobject ParaMEDMEM::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
203 %newobject ParaMEDMEM::MEDCouplingMesh::mergeMyselfWith;
204 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic;
205 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic2;
206 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic3;
207 %newobject ParaMEDMEM::MEDCouplingMesh::getMeasureField;
208 %newobject ParaMEDMEM::MEDCouplingMesh::simplexize;
209 %newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured;
210 %newobject ParaMEDMEM::MEDCouplingMesh::MergeMeshes;
211 %newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer;
212 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellsInBoundingBox;
213 %newobject ParaMEDMEM::MEDCouplingPointSet::findBoundaryNodes;
214 %newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh;
215 %newobject ParaMEDMEM::MEDCouplingPointSet::MergeNodesArray;
216 %newobject ParaMEDMEM::MEDCouplingPointSet::buildPartOfMySelf2;
217 %newobject ParaMEDMEM::MEDCouplingPointSet::BuildInstanceFromMeshType;
218 %newobject ParaMEDMEM::MEDCouplingPointSet::zipConnectivityTraducer;
219 %newobject ParaMEDMEM::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
220 %newobject ParaMEDMEM::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
221 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellIdsLyingOnNodes;
222 %newobject ParaMEDMEM::MEDCouplingPointSet::deepCpyConnectivityOnly;
223 %newobject ParaMEDMEM::MEDCouplingPointSet::getBoundingBoxForBBTree;
224 %newobject ParaMEDMEM::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells;
225 %newobject ParaMEDMEM::MEDCouplingPointSet::__getitem__;
226 %newobject ParaMEDMEM::MEDCouplingUMesh::New;
227 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
228 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
229 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
230 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
231 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
232 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
233 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
234 %newobject ParaMEDMEM::MEDCouplingUMesh::explode3DMeshTo1D;
235 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
236 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
237 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
238 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
239 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
240 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
241 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
242 %newobject ParaMEDMEM::MEDCouplingUMesh::conformize2D;
243 %newobject ParaMEDMEM::MEDCouplingUMesh::colinearize2D;
244 %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
245 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
246 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
247 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
248 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
249 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
250 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
251 %newobject ParaMEDMEM::MEDCouplingUMesh::convertLinearCellsToQuadratic;
252 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
253 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
254 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
255 %newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField;
256 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner;
257 %newobject ParaMEDMEM::MEDCouplingUMesh::computePlaneEquationOf3DFaces;
258 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField;
259 %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
260 %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
261 %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
262 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
263 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
264 %newobject ParaMEDMEM::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
265 %newobject ParaMEDMEM::MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh;
266 %newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
267 %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
268 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis;
269 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsCrossingPlane;
270 %newobject ParaMEDMEM::MEDCouplingUMesh::convexEnvelop2D;
271 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
272 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf2DMesh;
273 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf3DMesh;
274 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
275 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
276 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic;
277 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
278 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
279 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::New;
280 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::getNodalConnectivity;
281 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
282 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::New;
283 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
284 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::computeDualMesh;
285 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
286 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::sortHexa8EachOther;
287 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
288 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
289 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::New;
290 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
291 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
292 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
293 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
294 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
295 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
296 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::buildStructuredSubPart;
297 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTUnstructured;
298 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTSubLevelMesh;
299 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
300 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
301 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh;
302 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
303 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
304 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
305 %newobject ParaMEDMEM::MEDCouplingIMesh::New;
306 %newobject ParaMEDMEM::MEDCouplingIMesh::convertToCartesian;
307 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
308 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
309 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
310 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
311 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
312 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
314 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
315 %feature("unref") MEDCouplingMesh "$this->decrRef();"
316 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
317 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
318 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
319 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
320 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
321 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
322 %feature("unref") MEDCouplingField "$this->decrRef();"
323 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
324 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
325 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
326 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
327 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
328 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
329 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
330 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
331 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
333 %rename(assign) *::operator=;
334 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
335 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
336 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
337 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
341 %rename (InterpKernelException) INTERP_KERNEL::Exception;
343 %include "MEDCouplingRefCountObject.i"
344 %include "MEDCouplingMemArray.i"
362 CONST_ON_TIME_INTERVAL = 7
363 } TypeOfTimeDiscretization;
371 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
372 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11
373 } MEDCouplingMeshType;
376 class DataArrayDouble;
377 class MEDCouplingUMesh;
378 class MEDCouplingFieldDouble;
380 %extend RefCountObject
382 std::string getHiddenCppPointer() const
384 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
389 %extend MEDCouplingGaussLocalization
391 std::string __str__() const throw(INTERP_KERNEL::Exception)
393 return self->getStringRepr();
396 std::string __repr__() const throw(INTERP_KERNEL::Exception)
398 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
399 oss << self->getStringRepr();
406 class MEDCouplingMesh : public RefCountObject, public TimeLabel
409 void setName(const std::string& name);
410 std::string getName() const;
411 void setDescription(const std::string& descr);
412 std::string getDescription() const;
413 void setTime(double val, int iteration, int order);
414 void setTimeUnit(const std::string& unit);
415 std::string getTimeUnit() const;
416 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
417 bool isStructured() const throw(INTERP_KERNEL::Exception);
418 virtual MEDCouplingMesh *deepCpy() const;
419 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
420 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
421 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
422 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
423 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
424 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
425 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
426 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
427 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
428 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
429 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
430 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
431 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
432 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
433 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
434 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
435 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
436 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
437 virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
438 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
439 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
440 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
441 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
442 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
443 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
445 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
446 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
447 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
448 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
449 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception);
450 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
451 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
452 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
453 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
454 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
455 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
456 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
457 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
458 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
459 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
460 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
461 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
464 std::string __str__() const throw(INTERP_KERNEL::Exception)
466 return self->simpleRepr();
469 PyObject *getTime() throw(INTERP_KERNEL::Exception)
472 double tmp0=self->getTime(tmp1,tmp2);
473 PyObject *res = PyList_New(3);
474 PyList_SetItem(res,0,SWIG_From_double(tmp0));
475 PyList_SetItem(res,1,SWIG_From_int(tmp1));
476 PyList_SetItem(res,2,SWIG_From_int(tmp2));
480 int getCellContainingPoint(PyObject *p, 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::getCellContainingPoint : ";
489 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
490 return self->getCellContainingPoint(pos,eps);
493 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
497 DataArrayDoubleTuple *aa;
498 std::vector<double> bb;
500 int spaceDim=self->getSpaceDimension();
501 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
502 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
503 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
504 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
505 PyObject *ret=PyTuple_New(2);
506 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
507 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
511 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
513 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
514 int spaceDim=self->getSpaceDimension();
516 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
517 if (!SWIG_IsOK(res1))
520 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
521 int nbOfPoints=size/spaceDim;
524 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
526 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
530 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
532 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
533 da2->checkAllocated();
534 int size=da2->getNumberOfTuples();
535 int nbOfCompo=da2->getNumberOfComponents();
536 if(nbOfCompo!=spaceDim)
538 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
540 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
542 PyObject *ret=PyTuple_New(2);
543 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
544 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
548 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
552 DataArrayDoubleTuple *aa;
553 std::vector<double> bb;
555 int spaceDim=self->getSpaceDimension();
556 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
557 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
558 std::vector<int> elts;
559 self->getCellsContainingPoint(pos,eps,elts);
560 DataArrayInt *ret=DataArrayInt::New();
561 ret->alloc((int)elts.size(),1);
562 std::copy(elts.begin(),elts.end(),ret->getPointer());
563 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
566 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
568 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
569 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
570 self->getReverseNodalConnectivity(d0,d1);
571 PyObject *ret=PyTuple_New(2);
572 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
573 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
577 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
580 int v0; std::vector<int> v1;
581 const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
582 self->renumberCells(ids,check);
585 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
587 DataArrayInt *cellCor, *nodeCor;
588 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
589 PyObject *res = PyList_New(2);
590 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
591 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
595 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
597 DataArrayInt *cellCor=0,*nodeCor=0;
598 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
599 PyObject *res = PyList_New(2);
600 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
601 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
605 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
607 DataArrayInt *cellCor=0;
608 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
612 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
615 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
616 if (!SWIG_IsOK(res1))
619 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
620 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
624 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
626 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
627 da2->checkAllocated();
628 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
631 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
633 std::vector<int> conn;
634 self->getNodeIdsOfCell(cellId,conn);
635 return convertIntArrToPyList2(conn);
638 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
640 std::vector<double> coo;
641 self->getCoordinatesOfNode(nodeId,coo);
642 return convertDblArrToPyList2(coo);
645 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
649 DataArrayDoubleTuple *aa;
650 std::vector<double> bb;
652 int spaceDim=self->getSpaceDimension();
653 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
654 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
655 self->scale(pointPtr,factor);
658 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
660 int spaceDim=self->getSpaceDimension();
661 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
662 self->getBoundingBox(tmp);
663 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
667 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
670 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
671 PyObject *ret=PyTuple_New(2);
672 PyObject *ret0Py=ret0?Py_True:Py_False;
674 PyTuple_SetItem(ret,0,ret0Py);
675 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
679 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
681 int szArr,sw,iTypppArr;
682 std::vector<int> stdvecTyyppArr;
683 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
684 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
685 if(sw==3)//DataArrayInt
687 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
688 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
689 std::string name=argpt->getName();
691 ret->setName(name.c_str());
693 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
696 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
698 int szArr,sw,iTypppArr;
699 std::vector<int> stdvecTyyppArr;
701 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
702 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
703 if(sw==3)//DataArrayInt
705 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
706 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
707 std::string name=argpt->getName();
709 ret->setName(name.c_str());
712 PyObject *res = PyList_New(2);
713 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
714 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
715 PyList_SetItem(res,0,obj0);
716 PyList_SetItem(res,1,obj1);
720 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
724 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
725 PyObject *res = PyTuple_New(2);
726 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
729 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
731 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
732 PyTuple_SetItem(res,0,obj0);
733 PyTuple_SetItem(res,1,obj1);
737 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
739 std::vector<int> vals=self->getDistributionOfTypes();
741 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
742 PyObject *ret=PyList_New((int)vals.size()/3);
743 for(int j=0;j<(int)vals.size()/3;j++)
745 PyObject *ret1=PyList_New(3);
746 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
747 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
748 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
749 PyList_SetItem(ret,j,ret1);
754 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
756 std::vector<int> code;
757 std::vector<const DataArrayInt *> idsPerType;
758 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
759 convertPyToNewIntArr4(li,1,3,code);
760 return self->checkTypeConsistencyAndContig(code,idsPerType);
763 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
765 std::vector<int> code;
766 std::vector<DataArrayInt *> idsInPflPerType;
767 std::vector<DataArrayInt *> idsPerType;
768 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
769 PyObject *ret=PyTuple_New(3);
772 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
773 PyObject *ret0=PyList_New((int)code.size()/3);
774 for(int j=0;j<(int)code.size()/3;j++)
776 PyObject *ret00=PyList_New(3);
777 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
778 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
779 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
780 PyList_SetItem(ret0,j,ret00);
782 PyTuple_SetItem(ret,0,ret0);
784 PyObject *ret1=PyList_New(idsInPflPerType.size());
785 for(std::size_t j=0;j<idsInPflPerType.size();j++)
786 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
787 PyTuple_SetItem(ret,1,ret1);
788 int n=idsPerType.size();
789 PyObject *ret2=PyList_New(n);
791 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
792 PyTuple_SetItem(ret,2,ret2);
796 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
800 DataArrayDoubleTuple *aa;
801 std::vector<double> bb;
803 int spaceDim=self->getSpaceDimension();
804 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
805 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
806 self->translate(vectorPtr);
809 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
811 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
814 DataArrayDoubleTuple *aa;
815 std::vector<double> bb;
817 int spaceDim=self->getSpaceDimension();
818 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
819 self->rotate(centerPtr,0,alpha);
822 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
824 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
826 DataArrayDouble *a,*a2;
827 DataArrayDoubleTuple *aa,*aa2;
828 std::vector<double> bb,bb2;
830 int spaceDim=self->getSpaceDimension();
831 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
832 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
833 self->rotate(centerPtr,vectorPtr,alpha);
836 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
838 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
839 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
840 PyObject *res=PyList_New(result.size());
841 for(int i=0;iL!=result.end(); i++, iL++)
842 PyList_SetItem(res,i,PyInt_FromLong(*iL));
846 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
848 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
849 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
850 return MEDCouplingMesh::MergeMeshes(tmp);
856 //== MEDCouplingMesh End
858 %include "NormalizedGeometricTypes"
859 %include "MEDCouplingNatureOfFieldEnum"
863 class MEDCouplingNatureOfField
866 static const char *GetRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception);
867 static std::string GetReprNoThrow(NatureOfField nat);
868 static std::string GetAllPossibilitiesStr();
872 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
873 // include "MEDCouplingTimeDiscretization.i"
877 class MEDCouplingGaussLocalization
880 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
881 const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
882 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
883 INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
884 void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
885 int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
886 int getDimension() const throw(INTERP_KERNEL::Exception);
887 int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
888 std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
889 void checkCoherency() const throw(INTERP_KERNEL::Exception);
890 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception);
892 const std::vector<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
893 double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
894 const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
895 double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
896 const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
897 double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
898 void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
899 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
900 void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
901 void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
902 void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
903 void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
905 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
909 %include "MEDCouplingFieldDiscretization.i"
911 //== MEDCouplingPointSet
915 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
918 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
919 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
920 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
921 void zipCoords() throw(INTERP_KERNEL::Exception);
922 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
923 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
924 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
925 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
926 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
927 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
928 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
929 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
930 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
931 static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception);
932 virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
933 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
934 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
935 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
936 virtual DataArrayInt *findBoundaryNodes() const;
937 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
938 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
939 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
940 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
941 virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
942 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
945 std::string __str__() const throw(INTERP_KERNEL::Exception)
947 return self->simpleRepr();
950 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
953 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
954 PyObject *res = PyList_New(2);
955 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
956 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
960 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
962 DataArrayInt *comm, *commIndex;
963 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
964 PyObject *res = PyList_New(2);
965 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
966 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
970 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
972 DataArrayDouble *ret1=self->getCoords();
975 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
978 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
980 int szArr,sw,iTypppArr;
981 std::vector<int> stdvecTyyppArr;
982 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
983 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
984 if(sw==3)//DataArrayInt
986 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
987 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
988 std::string name=argpt->getName();
990 ret->setName(name.c_str());
992 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
995 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
997 int szArr,sw,iTypppArr;
998 std::vector<int> stdvecTyyppArr;
999 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1000 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1001 if(sw==3)//DataArrayInt
1003 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1004 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1005 std::string name=argpt->getName();
1007 ret->setName(name.c_str());
1009 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1012 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
1014 int szArr,sw,iTypppArr;
1015 std::vector<int> stdvecTyyppArr;
1016 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1017 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1018 if(sw==3)//DataArrayInt
1020 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1021 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1022 std::string name=argpt->getName();
1024 ret->setName(name.c_str());
1026 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1029 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1031 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1032 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1035 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1037 int szArr,sw,iTypppArr;
1038 std::vector<int> stdvecTyyppArr;
1039 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1040 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1041 if(sw==3)//DataArrayInt
1043 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1044 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1045 std::string name=argpt->getName();
1047 ret->setName(name.c_str());
1049 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1052 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1054 int szArr,sw,iTypppArr;
1055 std::vector<int> stdvecTyyppArr;
1056 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1057 self->renumberNodes(tmp,newNbOfNodes);
1060 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1062 int szArr,sw,iTypppArr;
1063 std::vector<int> stdvecTyyppArr;
1064 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1065 self->renumberNodes2(tmp,newNbOfNodes);
1068 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1070 int spaceDim=self->getSpaceDimension();
1072 DataArrayDouble *a,*a2;
1073 DataArrayDoubleTuple *aa,*aa2;
1074 std::vector<double> bb,bb2;
1076 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1077 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1078 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1079 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1080 std::vector<int> nodes;
1081 self->findNodesOnLine(p,v,eps,nodes);
1082 DataArrayInt *ret=DataArrayInt::New();
1083 ret->alloc((int)nodes.size(),1);
1084 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1085 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1087 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1089 int spaceDim=self->getSpaceDimension();
1091 DataArrayDouble *a,*a2;
1092 DataArrayDoubleTuple *aa,*aa2;
1093 std::vector<double> bb,bb2;
1095 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1096 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1097 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1098 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1099 std::vector<int> nodes;
1100 self->findNodesOnPlane(p,v,eps,nodes);
1101 DataArrayInt *ret=DataArrayInt::New();
1102 ret->alloc((int)nodes.size(),1);
1103 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1104 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1107 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1111 DataArrayDoubleTuple *aa;
1112 std::vector<double> bb;
1114 int spaceDim=self->getSpaceDimension();
1115 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1116 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1117 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1118 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1121 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1123 DataArrayInt *c=0,*cI=0;
1127 DataArrayDoubleTuple *aa;
1128 std::vector<double> bb;
1130 int spaceDim=self->getSpaceDimension();
1131 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1132 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1133 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1134 PyObject *ret=PyTuple_New(2);
1135 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1136 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1140 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1142 DataArrayInt *c=0,*cI=0;
1143 int spaceDim=self->getSpaceDimension();
1146 DataArrayDoubleTuple *aa;
1147 std::vector<double> bb;
1150 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1151 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1153 PyObject *ret=PyTuple_New(2);
1154 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1155 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1159 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1163 DataArrayDoubleTuple *aa;
1164 std::vector<double> bb;
1166 int spaceDim=self->getSpaceDimension();
1167 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1168 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1170 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1171 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1174 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1178 std::vector<int> multiVal;
1179 std::pair<int, std::pair<int,int> > slic;
1180 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1181 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1185 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1187 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1189 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1191 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1195 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1197 DataArrayInt *v0=0,*v1=0;
1198 self->findCommonCells(compType,startCellId,v0,v1);
1199 PyObject *res = PyList_New(2);
1200 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1201 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1206 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1209 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1210 if (!SWIG_IsOK(res1))
1213 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1214 self->renumberNodesInConn(tmp);
1218 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1220 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1221 da2->checkAllocated();
1222 self->renumberNodesInConn(da2->getConstPointer());
1226 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1229 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1230 PyObject *ret=PyTuple_New(2);
1231 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1232 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1236 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1238 DataArrayInt *ret=0;
1240 int szArr,sw,iTypppArr;
1241 std::vector<int> stdvecTyyppArr;
1242 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1243 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1247 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1251 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1252 PyObject *res = PyList_New(3);
1253 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1254 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1255 PyList_SetItem(res,2,SWIG_From_int(ret2));
1259 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1263 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1264 PyObject *res = PyList_New(3);
1265 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1266 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1267 PyList_SetItem(res,2,SWIG_From_int(ret2));
1271 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1274 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1275 if (!SWIG_IsOK(res1))
1278 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1279 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1283 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1285 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1286 da2->checkAllocated();
1287 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1291 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1295 std::vector<int> multiVal;
1296 std::pair<int, std::pair<int,int> > slic;
1297 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1298 int nbc=self->getNumberOfCells();
1299 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1306 std::ostringstream oss;
1307 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1308 throw INTERP_KERNEL::Exception(oss.str().c_str());
1311 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1316 int tmp=nbc+singleVal;
1317 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1321 std::ostringstream oss;
1322 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1323 throw INTERP_KERNEL::Exception(oss.str().c_str());
1329 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1333 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1338 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1339 daIntTyypp->checkAllocated();
1340 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1343 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1347 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1350 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1351 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1352 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1353 for(int i=0;i<sz;i++)
1354 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1357 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1360 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1362 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1363 std::vector<double> val3;
1364 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1365 "Rotate2DAlg",2,true,nbNodes);
1367 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1368 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1371 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1374 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1375 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1376 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1377 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1378 for(int i=0;i<sz;i++)
1379 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1382 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1385 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1387 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1388 std::vector<double> val3;
1389 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1390 "Rotate3DAlg",3,true,nbNodes);
1392 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1393 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1394 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1399 //== MEDCouplingPointSet End
1401 class MEDCouplingUMeshCell
1404 INTERP_KERNEL::NormalizedCellType getType() const;
1407 std::string __str__() const throw(INTERP_KERNEL::Exception)
1409 return self->repr();
1412 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1415 const int *r=self->getAllConn(ret2);
1416 PyObject *ret=PyTuple_New(ret2);
1417 for(int i=0;i<ret2;i++)
1418 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1424 class MEDCouplingUMeshCellIterator
1431 MEDCouplingUMeshCell *ret=self->nextt();
1433 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1436 PyErr_SetString(PyExc_StopIteration,"No more data.");
1443 class MEDCouplingUMeshCellByTypeIterator
1446 ~MEDCouplingUMeshCellByTypeIterator();
1451 MEDCouplingUMeshCellEntry *ret=self->nextt();
1453 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1456 PyErr_SetString(PyExc_StopIteration,"No more data.");
1463 class MEDCouplingUMeshCellByTypeEntry
1466 ~MEDCouplingUMeshCellByTypeEntry();
1469 MEDCouplingUMeshCellByTypeIterator *__iter__()
1471 return self->iterator();
1476 class MEDCouplingUMeshCellEntry
1479 INTERP_KERNEL::NormalizedCellType getType() const;
1480 int getNumberOfElems() const;
1483 MEDCouplingUMeshCellIterator *__iter__()
1485 return self->iterator();
1490 //== MEDCouplingUMesh
1492 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1495 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1496 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1497 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1498 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1499 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1500 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1501 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1502 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1503 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1504 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1505 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1506 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1507 void computeTypes() throw(INTERP_KERNEL::Exception);
1508 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1509 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1511 DataArrayInt *conformize2D(double eps) throw(INTERP_KERNEL::Exception);
1512 DataArrayInt *colinearize2D(double eps) throw(INTERP_KERNEL::Exception);
1513 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1514 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1515 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1516 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1517 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1518 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1519 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1520 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1521 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1522 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1523 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1524 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1525 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1526 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1527 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1528 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1529 bool isFullyQuadratic() const throw(INTERP_KERNEL::Exception);
1530 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1531 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1532 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1533 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1534 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1535 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1536 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1537 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1538 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1539 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1540 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1541 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1542 DataArrayDouble *computePlaneEquationOf3DFaces() const throw(INTERP_KERNEL::Exception);
1543 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1544 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1545 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1546 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1547 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1548 DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1549 DataArrayInt *buildUnionOf2DMesh() const throw(INTERP_KERNEL::Exception);
1550 DataArrayInt *buildUnionOf3DMesh() const throw(INTERP_KERNEL::Exception);
1551 DataArrayDouble *getBoundingBoxForBBTreeFast() const throw(INTERP_KERNEL::Exception);
1552 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1553 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1554 int split2DCells(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI, const DataArrayInt *midOpt=0, const DataArrayInt *midOptI=0) throw(INTERP_KERNEL::Exception);
1555 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1556 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1557 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1558 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1559 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1561 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1563 return MEDCouplingUMesh::New();
1566 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1568 return MEDCouplingUMesh::New(meshName,meshDim);
1571 std::string __str__() const throw(INTERP_KERNEL::Exception)
1573 return self->simpleRepr();
1576 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1578 std::ostringstream oss;
1579 self->reprQuickOverview(oss);
1583 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1585 return self->cellIterator();
1588 PyObject *getAllGeoTypesSorted() const throw(INTERP_KERNEL::Exception)
1590 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
1591 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1592 PyObject *res=PyList_New(result.size());
1593 for(int i=0;iL!=result.end(); i++, iL++)
1594 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1598 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1602 std::vector<int> multiVal;
1603 std::pair<int, std::pair<int,int> > slic;
1604 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1605 int nbc=self->getNumberOfCells();
1606 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1613 std::ostringstream oss;
1614 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1615 throw INTERP_KERNEL::Exception(oss.str().c_str());
1619 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1626 int tmp=nbc+singleVal;
1627 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1632 std::ostringstream oss;
1633 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1634 throw INTERP_KERNEL::Exception(oss.str().c_str());
1640 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1646 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1647 daIntTyypp->checkAllocated();
1648 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1652 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1656 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1660 std::vector<int> multiVal;
1661 std::pair<int, std::pair<int,int> > slic;
1662 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1663 int nbc=self->getNumberOfCells();
1664 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1671 std::ostringstream oss;
1672 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1673 throw INTERP_KERNEL::Exception(oss.str().c_str());
1677 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1684 int tmp=nbc+singleVal;
1685 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1690 std::ostringstream oss;
1691 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1692 throw INTERP_KERNEL::Exception(oss.str().c_str());
1698 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1703 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1709 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1710 daIntTyypp->checkAllocated();
1711 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1715 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1719 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1721 int szArr,sw,iTypppArr;
1722 std::vector<int> stdvecTyyppArr;
1723 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1726 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1727 throw INTERP_KERNEL::Exception(oss.str().c_str());
1729 self->insertNextCell(type,size,tmp);
1732 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1734 int szArr,sw,iTypppArr;
1735 std::vector<int> stdvecTyyppArr;
1736 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1737 self->insertNextCell(type,szArr,tmp);
1740 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1742 DataArrayInt *ret=self->getNodalConnectivity();
1747 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1749 DataArrayInt *ret=self->getNodalConnectivityIndex();
1755 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1757 int szArr,sw,iTypppArr;
1758 std::vector<int> stdvecTyyppArr;
1759 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1760 int nbOfDepthPeelingPerformed=0;
1761 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1762 PyObject *res=PyTuple_New(2);
1763 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1764 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1768 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1770 DataArrayInt *v0=0,*v1=0;
1771 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1772 PyObject *res = PyList_New(2);
1773 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1774 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1778 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1782 DataArrayDoubleTuple *aa;
1783 std::vector<double> bb;
1785 int nbOfCompo=self->getSpaceDimension();
1786 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1789 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1790 PyObject *ret=PyTuple_New(2);
1791 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1792 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1796 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1798 DataArrayInt *ret1=0;
1799 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1800 PyObject *ret=PyTuple_New(2);
1801 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1802 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1806 PyObject *tetrahedrize(int policy) throw(INTERP_KERNEL::Exception)
1809 DataArrayInt *ret1(0);
1810 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
1811 PyObject *ret=PyTuple_New(3);
1812 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
1813 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1814 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
1818 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1820 std::vector<int> cells;
1821 self->checkButterflyCells(cells,eps);
1822 DataArrayInt *ret=DataArrayInt::New();
1823 ret->alloc((int)cells.size(),1);
1824 std::copy(cells.begin(),cells.end(),ret->getPointer());
1825 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1828 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1830 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1832 PyObject *ret = PyList_New(sz);
1833 for(int i=0;i<sz;i++)
1834 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1838 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1840 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1841 int sz=retCpp.size();
1842 PyObject *ret=PyList_New(sz);
1843 for(int i=0;i<sz;i++)
1844 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1848 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1851 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1852 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1853 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1856 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1859 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1860 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1864 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1867 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1868 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1872 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1874 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1875 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1876 PyObject *ret=PyTuple_New(3);
1877 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1878 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1879 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1883 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1885 DataArrayInt *tmp0=0,*tmp1=0;
1886 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1887 PyObject *ret=PyTuple_New(2);
1888 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1889 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1893 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1897 std::vector<int> multiVal;
1898 std::pair<int, std::pair<int,int> > slic;
1899 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1900 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1904 return self->duplicateNodes(&singleVal,&singleVal+1);
1906 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
1908 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
1910 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1914 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
1918 std::vector<int> multiVal;
1919 std::pair<int, std::pair<int,int> > slic;
1920 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1921 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1925 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
1927 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
1929 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
1931 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1935 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
1938 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1939 DataArrayInt *tmp0,*tmp1=0;
1940 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
1941 PyObject *ret=PyTuple_New(2);
1942 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1943 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1947 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const throw(INTERP_KERNEL::Exception)
1949 DataArrayInt *ret0=0,*ret1=0;
1950 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
1951 PyObject *ret=PyTuple_New(2);
1952 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1953 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1957 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1959 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1960 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1961 DataArrayInt *ret1=0,*ret2=0;
1962 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
1963 PyObject *ret=PyTuple_New(3);
1964 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1965 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1966 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1970 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1972 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1973 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1974 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
1975 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1978 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
1981 std::vector<const MEDCouplingUMesh *> meshes;
1982 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1983 std::vector<DataArrayInt *> corr;
1984 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
1986 PyObject *ret1=PyList_New(sz);
1987 for(int i=0;i<sz;i++)
1988 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1989 PyObject *ret=PyList_New(2);
1990 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1991 PyList_SetItem(ret,1,ret1);
1995 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1997 std::vector<MEDCouplingUMesh *> meshes;
1998 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1999 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2002 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
2004 std::vector<MEDCouplingUMesh *> meshes;
2005 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2006 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2009 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
2013 std::vector<int> multiVal;
2014 std::pair<int, std::pair<int,int> > slic;
2015 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2017 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2018 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2022 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2024 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2026 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2028 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2032 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2034 DataArrayInt *arrOut=0,*arrIndexOut=0;
2037 std::vector<int> multiVal;
2038 std::pair<int, std::pair<int,int> > slic;
2039 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2041 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2042 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2047 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2052 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2057 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2061 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2063 PyObject *ret=PyTuple_New(2);
2064 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2065 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2069 static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2071 DataArrayInt *arrOut=0,*arrIndexOut=0;
2072 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2073 PyObject *ret=PyTuple_New(2);
2074 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2075 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2079 static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2081 if(!PySlice_Check(slic))
2082 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !");
2083 Py_ssize_t strt=2,stp=2,step=2;
2084 PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
2086 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !");
2087 arrIndxIn->checkAllocated();
2088 if(arrIndxIn->getNumberOfComponents()!=1)
2089 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !");
2090 GetIndicesOfSlice(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !");
2091 DataArrayInt *arrOut=0,*arrIndexOut=0;
2092 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2093 PyObject *ret=PyTuple_New(2);
2094 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2095 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2099 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2100 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2101 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2103 DataArrayInt *arrOut=0,*arrIndexOut=0;
2106 std::vector<int> multiVal;
2107 std::pair<int, std::pair<int,int> > slic;
2108 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2110 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2111 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2116 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2121 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2126 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2130 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2132 PyObject *ret=PyTuple_New(2);
2133 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2134 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2138 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2139 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2143 std::vector<int> multiVal;
2144 std::pair<int, std::pair<int,int> > slic;
2145 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2147 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2148 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2153 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2158 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2163 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2167 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2171 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2175 DataArrayDoubleTuple *aa;
2176 std::vector<double> bb;
2178 int spaceDim=self->getSpaceDimension();
2179 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2180 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2182 std::vector<int> cells;
2183 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2184 DataArrayInt *ret=DataArrayInt::New();
2185 ret->alloc((int)cells.size(),1);
2186 std::copy(cells.begin(),cells.end(),ret->getPointer());
2187 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2190 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2194 DataArrayDoubleTuple *aa;
2195 std::vector<double> bb;
2197 int spaceDim=self->getSpaceDimension();
2198 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2199 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2200 self->orientCorrectly2DCells(v,polyOnly);
2203 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2205 std::vector<int> cells;
2206 self->arePolyhedronsNotCorrectlyOriented(cells);
2207 DataArrayInt *ret=DataArrayInt::New();
2208 ret->alloc((int)cells.size(),1);
2209 std::copy(cells.begin(),cells.end(),ret->getPointer());
2210 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2213 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2217 self->getFastAveragePlaneOfThis(vec,pos);
2219 std::copy(vec,vec+3,vals);
2220 std::copy(pos,pos+3,vals+3);
2221 return convertDblArrToPyListOfTuple(vals,3,2);
2224 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2226 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2227 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2228 return MEDCouplingUMesh::MergeUMeshes(tmp);
2231 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2234 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2235 PyObject *ret=PyTuple_New(2);
2236 PyObject *ret0Py=ret0?Py_True:Py_False;
2238 PyTuple_SetItem(ret,0,ret0Py);
2239 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2243 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2246 bool ret0=self->areCellsIncludedIn2(other,ret1);
2247 PyObject *ret=PyTuple_New(2);
2248 PyObject *ret0Py=ret0?Py_True:Py_False;
2250 PyTuple_SetItem(ret,0,ret0Py);
2251 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2255 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2257 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2258 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2259 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2260 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2261 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2262 PyObject *ret=PyTuple_New(5);
2263 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2264 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2265 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2266 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2267 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2271 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2273 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2274 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2275 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2276 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2277 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2278 PyObject *ret=PyTuple_New(5);
2279 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2280 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2281 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2282 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2283 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2287 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2289 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2290 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2291 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2292 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2293 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2294 PyObject *ret=PyTuple_New(5);
2295 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2296 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2297 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2298 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2299 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2303 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2305 DataArrayInt *neighbors=0,*neighborsIdx=0;
2306 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2307 PyObject *ret=PyTuple_New(2);
2308 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2309 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2313 PyObject *computeNeighborsOfNodes() const throw(INTERP_KERNEL::Exception)
2315 DataArrayInt *neighbors=0,*neighborsIdx=0;
2316 self->computeNeighborsOfNodes(neighbors,neighborsIdx);
2317 PyObject *ret=PyTuple_New(2);
2318 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2319 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2323 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2325 DataArrayInt *neighbors=0,*neighborsIdx=0;
2326 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2327 PyObject *ret=PyTuple_New(2);
2328 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2329 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2333 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2335 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2336 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2337 DataArrayInt *d2,*d3,*d4,*dd5;
2338 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2339 PyObject *ret=PyTuple_New(7);
2340 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2341 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2342 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2343 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2344 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2345 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2346 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2350 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2353 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2354 da->checkAllocated();
2355 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2358 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2361 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2362 da->checkAllocated();
2363 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2366 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2369 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2370 da->checkAllocated();
2371 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2374 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2377 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2378 da->checkAllocated();
2379 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2380 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2381 PyObject *res = PyList_New(result.size());
2382 for (int i=0;iL!=result.end(); i++, iL++)
2383 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2387 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2390 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2391 da->checkAllocated();
2392 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2393 ret->setName(da->getName().c_str());
2397 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2399 DataArrayInt *cellNb1=0,*cellNb2=0;
2400 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2401 PyObject *ret=PyTuple_New(3);
2402 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2403 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2404 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2408 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2410 int spaceDim=self->getSpaceDimension();
2412 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2414 DataArrayDouble *a,*a2;
2415 DataArrayDoubleTuple *aa,*aa2;
2416 std::vector<double> bb,bb2;
2418 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2419 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2420 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2421 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2423 DataArrayInt *cellIds=0;
2424 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2425 PyObject *ret=PyTuple_New(2);
2426 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2427 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2431 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2433 int spaceDim=self->getSpaceDimension();
2435 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2437 DataArrayDouble *a,*a2;
2438 DataArrayDoubleTuple *aa,*aa2;
2439 std::vector<double> bb,bb2;
2441 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2442 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2443 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2444 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2446 DataArrayInt *cellIds=0;
2447 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2448 PyObject *ret=PyTuple_New(2);
2449 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2450 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2454 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2456 int spaceDim=self->getSpaceDimension();
2458 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2460 DataArrayDouble *a,*a2;
2461 DataArrayDoubleTuple *aa,*aa2;
2462 std::vector<double> bb,bb2;
2464 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2465 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2466 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2467 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2468 return self->getCellIdsCrossingPlane(orig,vect,eps);
2471 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2475 std::vector<int> pos2;
2476 DataArrayInt *pos3=0;
2477 DataArrayIntTuple *pos4=0;
2478 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2483 self->convertToPolyTypes(&pos1,&pos1+1);
2490 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2495 self->convertToPolyTypes(pos3->begin(),pos3->end());
2499 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2503 void convertAllToPoly();
2504 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2505 bool unPolyze() throw(INTERP_KERNEL::Exception);
2506 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2507 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2508 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2511 //== MEDCouplingUMesh End
2513 //== MEDCouplingExtrudedMesh
2515 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2518 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2519 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2521 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2523 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2526 std::string __str__() const throw(INTERP_KERNEL::Exception)
2528 return self->simpleRepr();
2531 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2533 std::ostringstream oss;
2534 self->reprQuickOverview(oss);
2538 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2540 MEDCouplingUMesh *ret=self->getMesh2D();
2543 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2545 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2547 MEDCouplingUMesh *ret=self->getMesh1D();
2550 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2552 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2554 DataArrayInt *ret=self->getMesh3DIds();
2557 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2562 //== MEDCouplingExtrudedMesh End
2564 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2567 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2568 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2569 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2570 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2571 virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2572 virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
2575 virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2577 int szArr,sw,iTypppArr;
2578 std::vector<int> stdvecTyyppArr;
2579 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2580 self->insertNextCell(tmp,tmp+szArr);
2583 virtual DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2585 DataArrayInt *ret=self->getNodalConnectivity();
2586 if(ret) ret->incrRef();
2590 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2592 std::vector< const MEDCoupling1GTUMesh *> parts;
2593 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
2594 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
2599 //== MEDCoupling1SGTUMesh
2601 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2604 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2605 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2606 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2607 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2608 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2609 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2610 MEDCoupling1GTUMesh *computeDualMesh() const throw(INTERP_KERNEL::Exception);
2611 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const throw(INTERP_KERNEL::Exception);
2612 DataArrayInt *sortHexa8EachOther() throw(INTERP_KERNEL::Exception);
2615 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2617 return MEDCoupling1SGTUMesh::New(name,type);
2620 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2622 return MEDCoupling1SGTUMesh::New(m);
2625 std::string __str__() const throw(INTERP_KERNEL::Exception)
2627 return self->simpleRepr();
2630 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2632 std::ostringstream oss;
2633 self->reprQuickOverview(oss);
2637 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2639 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2640 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2641 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2644 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2646 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2647 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2648 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2653 //== MEDCoupling1SGTUMesh End
2655 //== MEDCoupling1DGTUMesh
2657 class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2660 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2661 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2662 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
2663 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2664 bool isPacked() const throw(INTERP_KERNEL::Exception);
2667 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2669 return MEDCoupling1DGTUMesh::New(name,type);
2672 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2674 return MEDCoupling1DGTUMesh::New(m);
2677 std::string __str__() const throw(INTERP_KERNEL::Exception)
2679 return self->simpleRepr();
2682 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2684 std::ostringstream oss;
2685 self->reprQuickOverview(oss);
2689 DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
2691 DataArrayInt *ret=self->getNodalConnectivityIndex();
2692 if(ret) ret->incrRef();
2696 PyObject *retrievePackedNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2698 DataArrayInt *ret1=0,*ret2=0;
2699 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
2700 PyObject *ret0Py=ret0?Py_True:Py_False;
2702 PyObject *ret=PyTuple_New(3);
2703 PyTuple_SetItem(ret,0,ret0Py);
2704 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2705 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2709 PyObject *copyWithNodalConnectivityPacked() const throw(INTERP_KERNEL::Exception)
2712 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
2713 PyObject *ret=PyTuple_New(2);
2714 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
2715 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
2716 PyTuple_SetItem(ret,1,ret1Py);
2720 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2722 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2723 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2724 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
2727 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2729 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2730 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2731 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
2734 static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt) throw(INTERP_KERNEL::Exception)
2736 std::vector<const ParaMEDMEM::DataArrayInt *> tmp;
2737 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2738 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
2743 //== MEDCoupling1DGTUMeshEnd
2745 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2748 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2749 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2750 int getNumberOfCellsOfSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2751 int getSpaceDimensionOnNodeStruct() const throw(INTERP_KERNEL::Exception);
2752 virtual std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2753 std::vector<int> getCellGridStructure() const throw(INTERP_KERNEL::Exception);
2754 MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception);
2755 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
2756 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2759 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const throw(INTERP_KERNEL::Exception)
2761 int tmpp1=-1,tmpp2=-1;
2762 std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
2763 std::vector< std::pair<int,int> > inp;
2767 for(int i=0;i<tmpp1;i++)
2768 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2773 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
2774 inp.resize(tmpp1/2);
2775 for(int i=0;i<tmpp1/2;i++)
2776 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2779 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
2780 return self->buildStructuredSubPart(inp);
2783 static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) throw(INTERP_KERNEL::Exception)
2785 int tmpp1=-1,tmpp2=-1;
2786 std::vector<int> tmp=fillArrayWithPyListInt2(part,tmpp1,tmpp2);
2787 std::vector< std::pair<int,int> > inp;
2791 for(int i=0;i<tmpp1;i++)
2792 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2797 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.BuildExplicitIdsFrom : invalid input size ! Must be even size !");
2798 inp.resize(tmpp1/2);
2799 for(int i=0;i<tmpp1/2;i++)
2800 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2803 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.BuildExplicitIdsFrom : invalid input size !");
2805 int szArr,sw,iTypppArr;
2806 std::vector<int> stdvecTyyppArr;
2807 const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
2808 std::vector<int> tmp5(tmp4,tmp4+szArr);
2810 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
2813 static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) throw(INTERP_KERNEL::Exception)
2815 int szArr,sw,iTypppArr;
2816 std::vector<int> stdvecTyyppArr;
2817 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2818 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
2821 static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2823 int szArr,sw,iTypppArr;
2824 std::vector<int> stdvecTyyppArr;
2825 const int *tmp(convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr));
2826 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
2829 static PyObject *IsPartStructured(PyObject *li, PyObject *st) throw(INTERP_KERNEL::Exception)
2831 int szArr,sw,iTypppArr;
2832 std::vector<int> stdvecTyyppArr;
2833 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2834 int szArr2,sw2,iTypppArr2;
2835 std::vector<int> stdvecTyyppArr2;
2836 const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
2837 std::vector<int> tmp3(tmp2,tmp2+szArr2);
2838 std::vector< std::pair<int,int> > partCompactFormat;
2839 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
2840 PyObject *ret=PyTuple_New(2);
2841 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
2842 PyTuple_SetItem(ret,0,ret0Py);
2843 PyObject *ret1Py=PyList_New(partCompactFormat.size());
2844 for(std::size_t i=0;i<partCompactFormat.size();i++)
2846 PyObject *tmp4=PyTuple_New(2);
2847 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
2848 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
2849 PyList_SetItem(ret1Py,i,tmp4);
2851 PyTuple_SetItem(ret,1,ret1Py);
2857 //== MEDCouplingCMesh
2859 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2862 static MEDCouplingCMesh *New() throw(INTERP_KERNEL::Exception);
2863 static MEDCouplingCMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
2864 MEDCouplingCMesh *clone(bool recDeepCpy) const;
2865 void setCoords(const DataArrayDouble *coordsX,
2866 const DataArrayDouble *coordsY=0,
2867 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
2868 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
2870 MEDCouplingCMesh() throw(INTERP_KERNEL::Exception)
2872 return MEDCouplingCMesh::New();
2874 MEDCouplingCMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
2876 return MEDCouplingCMesh::New(meshName);
2878 std::string __str__() const throw(INTERP_KERNEL::Exception)
2880 return self->simpleRepr();
2882 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2884 std::ostringstream oss;
2885 self->reprQuickOverview(oss);
2888 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
2890 DataArrayDouble *ret=self->getCoordsAt(i);
2898 //== MEDCouplingCMesh End
2900 //== MEDCouplingCurveLinearMesh
2902 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2905 static MEDCouplingCurveLinearMesh *New() throw(INTERP_KERNEL::Exception);
2906 static MEDCouplingCurveLinearMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
2907 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
2908 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
2910 MEDCouplingCurveLinearMesh() throw(INTERP_KERNEL::Exception)
2912 return MEDCouplingCurveLinearMesh::New();
2914 MEDCouplingCurveLinearMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
2916 return MEDCouplingCurveLinearMesh::New(meshName);
2918 std::string __str__() const throw(INTERP_KERNEL::Exception)
2920 return self->simpleRepr();
2922 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2924 std::ostringstream oss;
2925 self->reprQuickOverview(oss);
2928 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
2930 DataArrayDouble *ret=self->getCoords();
2935 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
2937 int szArr,sw,iTypppArr;
2938 std::vector<int> stdvecTyyppArr;
2939 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
2940 self->setNodeGridStructure(tmp,tmp+szArr);
2945 //== MEDCouplingCurveLinearMesh End
2947 //== MEDCouplingIMesh
2949 class MEDCouplingIMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2952 static MEDCouplingIMesh *New() throw(INTERP_KERNEL::Exception);
2954 void setSpaceDimension(int spaceDim) throw(INTERP_KERNEL::Exception);
2955 std::vector<int> getNodeStruct() const throw(INTERP_KERNEL::Exception);
2956 std::vector<double> getOrigin() const throw(INTERP_KERNEL::Exception);
2957 std::vector<double> getDXYZ() const throw(INTERP_KERNEL::Exception);
2958 void setAxisUnit(const std::string& unitName) throw(INTERP_KERNEL::Exception);
2959 std::string getAxisUnit() const throw(INTERP_KERNEL::Exception);
2960 double getMeasureOfAnyCell() const throw(INTERP_KERNEL::Exception);
2961 MEDCouplingCMesh *convertToCartesian() const throw(INTERP_KERNEL::Exception);
2966 return MEDCouplingIMesh::New();
2968 static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
2970 static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
2971 static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
2972 const int *nodeStrctPtr(0);
2973 const double *originPtr(0),*dxyzPtr(0);
2975 std::vector<int> bb0;
2976 nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
2979 std::vector<double> bb,bb2;
2981 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
2982 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
2984 return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
2987 MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
2989 return ParaMEDMEM_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
2992 void setNodeStruct(PyObject *nodeStrct) throw(INTERP_KERNEL::Exception)
2995 std::vector<int> bb0;
2996 const int *nodeStrctPtr(convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0));
2997 self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
3000 void setOrigin(PyObject *origin) throw(INTERP_KERNEL::Exception)
3002 static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3005 DataArrayDoubleTuple *aa;
3006 std::vector<double> bb;
3008 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
3009 self->setOrigin(originPtr,originPtr+nbTuples);
3012 void setDXYZ(PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3014 static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3017 DataArrayDoubleTuple *aa;
3018 std::vector<double> bb;
3020 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
3021 self->setDXYZ(originPtr,originPtr+nbTuples);
3024 std::string __str__() const throw(INTERP_KERNEL::Exception)
3026 return self->simpleRepr();
3028 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3030 std::ostringstream oss;
3031 self->reprQuickOverview(oss);
3037 //== MEDCouplingIMesh End
3041 namespace ParaMEDMEM
3043 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
3046 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
3047 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
3048 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3049 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3050 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
3051 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
3052 void setName(const char *name) throw(INTERP_KERNEL::Exception);
3053 std::string getDescription() const throw(INTERP_KERNEL::Exception);
3054 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
3055 std::string getName() const throw(INTERP_KERNEL::Exception);
3056 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
3057 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
3058 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
3059 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
3060 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
3061 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
3062 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
3063 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3064 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
3065 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
3066 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
3067 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
3068 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
3069 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
3070 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
3071 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3073 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
3075 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3078 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3081 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
3083 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3086 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3089 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
3091 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
3092 return convertIntArrToPyList3(ret);
3095 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
3098 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
3099 PyObject *ret=PyTuple_New(2);
3100 PyObject *ret0Py=ret0?Py_True:Py_False;
3102 PyTuple_SetItem(ret,0,ret0Py);
3103 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3107 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
3109 DataArrayInt *ret1=0;
3110 MEDCouplingMesh *ret0=0;
3112 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3113 if (!SWIG_IsOK(res1))
3116 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3117 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3121 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3123 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3124 da2->checkAllocated();
3125 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3127 PyObject *res = PyList_New(2);
3128 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3129 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3133 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
3135 DataArrayInt *ret1=0;
3137 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3138 PyObject *res=PyTuple_New(2);
3139 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3141 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3144 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3145 PyTuple_SetItem(res,1,res1);
3150 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3153 int v0; std::vector<int> v1;
3154 const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
3155 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3158 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3159 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3162 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3163 if (!SWIG_IsOK(res1))
3166 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3167 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3171 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3173 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3174 da2->checkAllocated();
3175 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3179 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3181 std::vector<int> tmp;
3182 self->getCellIdsHavingGaussLocalization(locId,tmp);
3183 DataArrayInt *ret=DataArrayInt::New();
3184 ret->alloc((int)tmp.size(),1);
3185 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3186 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3189 int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
3191 std::vector<int> inp0;
3192 convertPyToNewIntArr4(code,1,3,inp0);
3193 std::vector<const DataArrayInt *> inp1;
3194 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(idsPerType,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",inp1);
3195 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3200 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3203 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3204 static MEDCouplingFieldTemplate *New(TypeOfField type);
3205 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3206 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3209 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3211 return MEDCouplingFieldTemplate::New(f);
3214 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3216 return MEDCouplingFieldTemplate::New(type);
3219 std::string __str__() const throw(INTERP_KERNEL::Exception)
3221 return self->simpleRepr();
3224 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3226 std::ostringstream oss;
3227 self->reprQuickOverview(oss);
3233 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3236 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3237 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3238 void setTimeUnit(const std::string& unit);
3239 std::string getTimeUnit() const;
3240 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3241 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3242 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3243 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3244 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3245 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
3246 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3247 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3248 MEDCouplingFieldDouble *deepCpy() const;
3249 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3250 MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
3251 MEDCouplingFieldDouble *cellToNodeDiscretization() const throw(INTERP_KERNEL::Exception);
3252 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3253 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3254 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3255 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3256 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3257 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3258 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3259 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3260 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3261 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3262 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3263 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3264 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3265 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3266 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3267 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3268 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3269 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3270 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3271 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3272 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3273 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3274 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3275 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3276 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3277 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3278 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3279 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3280 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3281 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3282 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3283 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3284 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3285 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3286 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3287 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3288 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3289 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3290 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3291 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3292 void fillFromAnalytic(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3293 void fillFromAnalytic2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3294 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3295 void applyFunc(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3296 void applyFunc2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3297 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3298 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3299 void applyFunc(const std::string& func) throw(INTERP_KERNEL::Exception);
3300 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
3301 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
3302 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3303 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3304 double getMinValue() const throw(INTERP_KERNEL::Exception);
3305 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3306 double norm2() const throw(INTERP_KERNEL::Exception);
3307 double normMax() const throw(INTERP_KERNEL::Exception);
3308 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3309 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3310 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3311 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3312 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3313 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3314 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3315 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3316 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3317 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3318 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3319 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3320 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3321 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3322 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3323 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3324 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3325 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3326 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3327 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3328 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3329 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3331 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3333 return MEDCouplingFieldDouble::New(type,td);
3336 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3338 return MEDCouplingFieldDouble::New(ft,td);
3341 std::string __str__() const throw(INTERP_KERNEL::Exception)
3343 return self->simpleRepr();
3346 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3348 std::ostringstream oss;
3349 self->reprQuickOverview(oss);
3353 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3355 DataArrayDouble *ret=self->getArray();
3361 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3363 std::vector<DataArrayDouble *> arrs=self->getArrays();
3364 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3368 PyObject *ret=PyTuple_New(sz);
3369 for(int i=0;i<sz;i++)
3372 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3374 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3379 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3381 std::vector<const DataArrayDouble *> tmp;
3382 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3384 std::vector<DataArrayDouble *> arrs(sz);
3385 for(int i=0;i<sz;i++)
3386 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3387 self->setArrays(arrs);
3390 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3392 DataArrayDouble *ret=self->getEndArray();
3398 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3402 DataArrayDoubleTuple *aa;
3403 std::vector<double> bb;
3405 const MEDCouplingMesh *mesh=self->getMesh();
3407 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3408 int spaceDim=mesh->getSpaceDimension();
3409 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3410 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3412 int sz=self->getNumberOfComponents();
3413 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3414 self->getValueOn(spaceLoc,res);
3415 return convertDblArrToPyList(res,sz);
3418 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3420 int sz=self->getNumberOfComponents();
3421 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3422 self->getValueOnPos(i,j,k,res);
3423 return convertDblArrToPyList(res,sz);
3426 DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
3428 const MEDCouplingMesh *mesh(self->getMesh());
3430 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3433 double v0; ParaMEDMEM::DataArrayDouble *v1(0); ParaMEDMEM::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
3434 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
3435 mesh->getSpaceDimension(),true,nbPts);
3436 return self->getValueOnMulti(inp,nbPts);
3439 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3443 DataArrayDoubleTuple *aa;
3444 std::vector<double> bb;
3446 const MEDCouplingMesh *mesh=self->getMesh();
3448 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3449 int spaceDim=mesh->getSpaceDimension();
3450 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3451 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3454 int sz=self->getNumberOfComponents();
3455 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3456 self->getValueOn(spaceLoc,time,res);
3457 return convertDblArrToPyList(res,sz);
3460 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3462 if(self->getArray()!=0)
3463 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3466 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3467 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3468 self->setArray(arr);
3472 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3475 double tmp0=self->getTime(tmp1,tmp2);
3476 PyObject *res = PyList_New(3);
3477 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3478 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3479 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3483 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3486 double tmp0=self->getStartTime(tmp1,tmp2);
3487 PyObject *res = PyList_New(3);
3488 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3489 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3490 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3494 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3497 double tmp0=self->getEndTime(tmp1,tmp2);
3498 PyObject *res = PyList_New(3);
3499 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3500 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3501 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3504 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3506 int sz=self->getNumberOfComponents();
3507 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3508 self->accumulate(tmp);
3509 return convertDblArrToPyList(tmp,sz);
3511 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3513 int sz=self->getNumberOfComponents();
3514 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3515 self->integral(isWAbs,tmp);
3516 return convertDblArrToPyList(tmp,sz);
3518 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3520 int sz=self->getNumberOfComponents();
3521 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3522 self->getWeightedAverageValue(tmp,isWAbs);
3523 return convertDblArrToPyList(tmp,sz);
3525 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3527 int sz=self->getNumberOfComponents();
3528 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3530 return convertDblArrToPyList(tmp,sz);
3532 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3534 int sz=self->getNumberOfComponents();
3535 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3537 return convertDblArrToPyList(tmp,sz);
3539 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3541 int szArr,sw,iTypppArr;
3542 std::vector<int> stdvecTyyppArr;
3543 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3544 self->renumberCells(tmp,check);
3547 void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3549 int szArr,sw,iTypppArr;
3550 std::vector<int> stdvecTyyppArr;
3551 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3552 self->renumberCellsWithoutMesh(tmp,check);
3555 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3557 int szArr,sw,iTypppArr;
3558 std::vector<int> stdvecTyyppArr;
3559 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3560 self->renumberNodes(tmp,eps);
3563 void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3565 int szArr,sw,iTypppArr;
3566 std::vector<int> stdvecTyyppArr;
3567 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3568 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
3571 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3575 std::vector<int> multiVal;
3576 std::pair<int, std::pair<int,int> > slic;
3577 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3578 const MEDCouplingMesh *mesh=self->getMesh();
3580 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3581 int nbc=mesh->getNumberOfCells();
3582 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3589 std::ostringstream oss;
3590 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3591 throw INTERP_KERNEL::Exception(oss.str().c_str());
3594 return self->buildSubPart(&singleVal,&singleVal+1);
3599 int tmp=nbc+singleVal;
3600 return self->buildSubPart(&tmp,&tmp+1);
3604 std::ostringstream oss;
3605 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3606 throw INTERP_KERNEL::Exception(oss.str().c_str());
3612 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3616 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3621 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3622 daIntTyypp->checkAllocated();
3623 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3626 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3630 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3632 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";
3633 if(PyTuple_Check(li))
3635 Py_ssize_t sz=PyTuple_Size(li);
3637 throw INTERP_KERNEL::Exception(msg);
3638 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3641 std::vector<int> multiVal;
3642 std::pair<int, std::pair<int,int> > slic;
3643 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3644 if(!self->getArray())
3645 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3647 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3648 catch(INTERP_KERNEL::Exception& e)
3649 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3650 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3651 DataArrayDouble *ret0Arr=ret0->getArray();
3653 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3658 std::vector<int> v2(1,singleVal);
3659 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3660 ret0->setArray(aarr);
3665 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3666 ret0->setArray(aarr);
3671 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3672 std::vector<int> v2(nbOfComp);
3673 for(int i=0;i<nbOfComp;i++)
3674 v2[i]=slic.first+i*slic.second.second;
3675 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3676 ret0->setArray(aarr);
3680 throw INTERP_KERNEL::Exception(msg);
3685 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3688 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3691 double r1=self->getMaxValue2(tmp);
3692 PyObject *ret=PyTuple_New(2);
3693 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3694 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3698 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3701 double r1=self->getMinValue2(tmp);
3702 PyObject *ret=PyTuple_New(2);
3703 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3704 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3708 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3710 std::vector<int> tmp;
3711 convertPyToNewIntArr3(li,tmp);
3712 return self->keepSelectedComponents(tmp);
3715 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3717 std::vector<int> tmp;
3718 convertPyToNewIntArr3(li,tmp);
3719 self->setSelectedComponents(f,tmp);
3722 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3725 DataArrayDouble *a,*a2;
3726 DataArrayDoubleTuple *aa,*aa2;
3727 std::vector<double> bb,bb2;
3730 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
3731 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
3732 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3733 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3735 return self->extractSlice3D(orig,vect,eps);
3738 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3740 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
3743 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3745 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
3748 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3750 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.";
3751 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
3754 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3756 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3758 return (*self)-(*other);
3760 throw INTERP_KERNEL::Exception(msg);
3765 DataArrayDoubleTuple *aa;
3766 std::vector<double> bb;
3768 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3773 if(!self->getArray())
3774 throw INTERP_KERNEL::Exception(msg2);
3775 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3776 ret->applyLin(1.,-val);
3777 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3778 ret2->setArray(ret);
3783 if(!self->getArray())
3784 throw INTERP_KERNEL::Exception(msg2);
3785 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
3786 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3787 ret2->setArray(ret);
3792 if(!self->getArray())
3793 throw INTERP_KERNEL::Exception(msg2);
3794 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3795 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3796 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3797 ret2->setArray(ret);
3802 if(!self->getArray())
3803 throw INTERP_KERNEL::Exception(msg2);
3804 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3805 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3806 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3807 ret2->setArray(ret);
3811 { throw INTERP_KERNEL::Exception(msg); }
3815 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3817 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
3820 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3822 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
3825 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3827 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
3830 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3832 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.";
3833 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
3836 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3838 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3840 return (*self)/(*other);
3842 throw INTERP_KERNEL::Exception(msg);
3847 DataArrayDoubleTuple *aa;
3848 std::vector<double> bb;
3850 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3856 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
3857 if(!self->getArray())
3858 throw INTERP_KERNEL::Exception(msg2);
3859 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3860 ret->applyLin(1./val,0);
3861 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3862 ret2->setArray(ret);
3867 if(!self->getArray())
3868 throw INTERP_KERNEL::Exception(msg2);
3869 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
3870 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3871 ret2->setArray(ret);
3876 if(!self->getArray())
3877 throw INTERP_KERNEL::Exception(msg2);
3878 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3879 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3880 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3881 ret2->setArray(ret);
3886 if(!self->getArray())
3887 throw INTERP_KERNEL::Exception(msg2);
3888 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3889 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3890 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3891 ret2->setArray(ret);
3895 { throw INTERP_KERNEL::Exception(msg); }
3899 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3901 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
3904 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3906 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.";
3907 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
3910 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3912 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3914 return (*self)^(*other);
3916 throw INTERP_KERNEL::Exception(msg);
3921 DataArrayDoubleTuple *aa;
3922 std::vector<double> bb;
3924 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3929 if(!self->getArray())
3930 throw INTERP_KERNEL::Exception(msg2);
3931 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3933 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3934 ret2->setArray(ret);
3939 if(!self->getArray())
3940 throw INTERP_KERNEL::Exception(msg2);
3941 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
3942 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3943 ret2->setArray(ret);
3948 if(!self->getArray())
3949 throw INTERP_KERNEL::Exception(msg2);
3950 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3951 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3952 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3953 ret2->setArray(ret);
3958 if(!self->getArray())
3959 throw INTERP_KERNEL::Exception(msg2);
3960 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3961 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3962 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3963 ret2->setArray(ret);
3967 { throw INTERP_KERNEL::Exception(msg); }
3971 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
3973 return self->negate();
3976 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3978 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.";
3979 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
3982 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3984 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3988 Py_XINCREF(trueSelf);
3992 throw INTERP_KERNEL::Exception(msg);
3997 DataArrayDoubleTuple *aa;
3998 std::vector<double> bb;
4000 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4005 if(!self->getArray())
4006 throw INTERP_KERNEL::Exception(msg2);
4007 self->getArray()->applyLin(1.,val);
4008 Py_XINCREF(trueSelf);
4013 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4016 Py_XINCREF(trueSelf);
4021 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4022 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4023 ret2->setArray(aaa);
4025 Py_XINCREF(trueSelf);
4030 if(!self->getArray())
4031 throw INTERP_KERNEL::Exception(msg2);
4032 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4033 self->getArray()->addEqual(aaa);
4034 Py_XINCREF(trueSelf);
4038 { throw INTERP_KERNEL::Exception(msg); }
4042 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4044 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.";
4045 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4048 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4050 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4054 Py_XINCREF(trueSelf);
4058 throw INTERP_KERNEL::Exception(msg);
4063 DataArrayDoubleTuple *aa;
4064 std::vector<double> bb;
4066 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4071 if(!self->getArray())
4072 throw INTERP_KERNEL::Exception(msg2);
4073 self->getArray()->applyLin(1.,-val);
4074 Py_XINCREF(trueSelf);
4079 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4082 Py_XINCREF(trueSelf);
4087 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4088 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4089 ret2->setArray(aaa);
4091 Py_XINCREF(trueSelf);
4096 if(!self->getArray())
4097 throw INTERP_KERNEL::Exception(msg2);
4098 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4099 self->getArray()->substractEqual(aaa);
4100 Py_XINCREF(trueSelf);
4104 { throw INTERP_KERNEL::Exception(msg); }
4108 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4110 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.";
4111 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4114 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4116 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4120 Py_XINCREF(trueSelf);
4124 throw INTERP_KERNEL::Exception(msg);
4129 DataArrayDoubleTuple *aa;
4130 std::vector<double> bb;
4132 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4137 if(!self->getArray())
4138 throw INTERP_KERNEL::Exception(msg2);
4139 self->getArray()->applyLin(val,0);
4140 Py_XINCREF(trueSelf);
4145 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4148 Py_XINCREF(trueSelf);
4153 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4154 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4155 ret2->setArray(aaa);
4157 Py_XINCREF(trueSelf);
4162 if(!self->getArray())
4163 throw INTERP_KERNEL::Exception(msg2);
4164 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4165 self->getArray()->multiplyEqual(aaa);
4166 Py_XINCREF(trueSelf);
4170 { throw INTERP_KERNEL::Exception(msg); }
4174 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4176 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.";
4177 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4180 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4182 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4186 Py_XINCREF(trueSelf);
4190 throw INTERP_KERNEL::Exception(msg);
4195 DataArrayDoubleTuple *aa;
4196 std::vector<double> bb;
4198 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4204 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4205 if(!self->getArray())
4206 throw INTERP_KERNEL::Exception(msg2);
4207 self->getArray()->applyLin(1./val,0);
4208 Py_XINCREF(trueSelf);
4213 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4216 Py_XINCREF(trueSelf);
4221 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4222 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4223 ret2->setArray(aaa);
4225 Py_XINCREF(trueSelf);
4230 if(!self->getArray())
4231 throw INTERP_KERNEL::Exception(msg2);
4232 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4233 self->getArray()->divideEqual(aaa);
4234 Py_XINCREF(trueSelf);
4238 { throw INTERP_KERNEL::Exception(msg); }
4242 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4244 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.";
4245 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4248 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4250 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4254 Py_XINCREF(trueSelf);
4258 throw INTERP_KERNEL::Exception(msg);
4263 DataArrayDoubleTuple *aa;
4264 std::vector<double> bb;
4266 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4271 if(!self->getArray())
4272 throw INTERP_KERNEL::Exception(msg2);
4273 self->getArray()->applyPow(val);
4274 Py_XINCREF(trueSelf);
4279 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4282 Py_XINCREF(trueSelf);
4287 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4288 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4289 ret2->setArray(aaa);
4291 Py_XINCREF(trueSelf);
4296 if(!self->getArray())
4297 throw INTERP_KERNEL::Exception(msg2);
4298 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4299 self->getArray()->powEqual(aaa);
4300 Py_XINCREF(trueSelf);
4304 { throw INTERP_KERNEL::Exception(msg); }
4308 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4310 std::vector<const MEDCouplingFieldDouble *> tmp;
4311 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4312 return MEDCouplingFieldDouble::MergeFields(tmp);
4315 static void WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
4317 std::vector<const MEDCouplingFieldDouble *> tmp;
4318 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4319 MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4324 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4327 int getNumberOfFields() const;
4328 MEDCouplingMultiFields *deepCpy() const;
4329 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4330 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4331 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4332 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4333 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4336 std::string __str__() const throw(INTERP_KERNEL::Exception)
4338 return self->simpleRepr();
4340 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4342 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4343 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4345 std::vector<MEDCouplingFieldDouble *> fs(sz);
4346 for(int i=0;i<sz;i++)
4347 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4348 return MEDCouplingMultiFields::New(fs);
4350 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4352 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4353 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4355 std::vector<MEDCouplingFieldDouble *> fs(sz);
4356 for(int i=0;i<sz;i++)
4357 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4358 return MEDCouplingMultiFields::New(fs);
4360 PyObject *getFields() const
4362 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4363 int sz=fields.size();
4364 PyObject *res = PyList_New(sz);
4365 for(int i=0;i<sz;i++)
4369 fields[i]->incrRef();
4370 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4374 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4379 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4381 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4385 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4388 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4390 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4392 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4394 PyObject *res = PyList_New(sz);
4395 for(int i=0;i<sz;i++)
4400 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4404 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4409 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4411 std::vector<int> refs;
4412 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4414 PyObject *res = PyList_New(sz);
4415 for(int i=0;i<sz;i++)
4420 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4424 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4428 PyObject *ret=PyTuple_New(2);
4429 PyTuple_SetItem(ret,0,res);
4430 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4433 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4435 std::vector<DataArrayDouble *> ms=self->getArrays();
4437 PyObject *res = PyList_New(sz);
4438 for(int i=0;i<sz;i++)
4443 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4447 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4452 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4454 std::vector< std::vector<int> > refs;
4455 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4457 PyObject *res = PyList_New(sz);
4458 PyObject *res2 = PyList_New(sz);
4459 for(int i=0;i<sz;i++)
4464 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4468 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4470 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4473 PyObject *ret=PyTuple_New(2);
4474 PyTuple_SetItem(ret,0,res);
4475 PyTuple_SetItem(ret,1,res2);
4481 class MEDCouplingDefinitionTime
4484 MEDCouplingDefinitionTime();
4485 void assign(const MEDCouplingDefinitionTime& other);
4486 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4487 double getTimeResolution() const;
4488 std::vector<double> getHotSpotsTime() const;
4491 std::string __str__() const throw(INTERP_KERNEL::Exception)
4493 std::ostringstream oss;
4494 self->appendRepr(oss);
4498 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4500 int meshId,arrId,arrIdInField,fieldId;
4501 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4502 PyObject *res=PyList_New(4);
4503 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4504 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4505 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4506 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4510 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4512 int meshId,arrId,arrIdInField,fieldId;
4513 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4514 PyObject *res=PyList_New(4);
4515 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4516 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4517 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4518 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4524 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4527 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4528 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4532 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4534 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4535 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4537 std::vector<MEDCouplingFieldDouble *> fs(sz);
4538 for(int i=0;i<sz;i++)
4539 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4540 return MEDCouplingFieldOverTime::New(fs);
4542 std::string __str__() const throw(INTERP_KERNEL::Exception)
4544 return self->simpleRepr();
4546 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4548 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4549 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4551 std::vector<MEDCouplingFieldDouble *> fs(sz);
4552 for(int i=0;i<sz;i++)
4553 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4554 return MEDCouplingFieldOverTime::New(fs);
4562 __filename=os.environ.get('PYTHONSTARTUP')
4563 if __filename and os.path.isfile(__filename):
4564 execfile(__filename)