1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
27 #include "MEDCouplingMemArray.hxx"
28 #include "MEDCouplingUMesh.hxx"
29 #include "MEDCouplingExtrudedMesh.hxx"
30 #include "MEDCouplingCMesh.hxx"
31 #include "MEDCouplingCurveLinearMesh.hxx"
32 #include "MEDCoupling1GTUMesh.hxx"
33 #include "MEDCouplingField.hxx"
34 #include "MEDCouplingFieldDouble.hxx"
35 #include "MEDCouplingFieldTemplate.hxx"
36 #include "MEDCouplingGaussLocalization.hxx"
37 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
38 #include "MEDCouplingMultiFields.hxx"
39 #include "MEDCouplingFieldOverTime.hxx"
40 #include "MEDCouplingDefinitionTime.hxx"
41 #include "MEDCouplingFieldDiscretization.hxx"
42 #include "MEDCouplingTypemaps.i"
44 #include "InterpKernelAutoPtr.hxx"
46 using namespace ParaMEDMEM;
47 using namespace INTERP_KERNEL;
51 %template(ivec) std::vector<int>;
52 %template(dvec) std::vector<double>;
53 %template(svec) std::vector<std::string>;
56 %typemap(out) ParaMEDMEM::MEDCouplingMesh*
58 $result=convertMesh($1,$owner);
61 %typemap(out) MEDCouplingMesh*
63 $result=convertMesh($1,$owner);
68 %typemap(out) ParaMEDMEM::MEDCouplingPointSet*
70 $result=convertMesh($1,$owner);
73 %typemap(out) MEDCouplingPointSet*
75 $result=convertMesh($1,$owner);
81 %typemap(out) ParaMEDMEM::MEDCoupling1GTUMesh*
83 $result=convertMesh($1,$owner);
86 %typemap(out) MEDCoupling1GTUMesh*
88 $result=convertMesh($1,$owner);
93 %typemap(out) ParaMEDMEM::MEDCouplingStructuredMesh*
95 $result=convertMesh($1,$owner);
98 %typemap(out) MEDCouplingStructuredMesh*
100 $result=convertMesh($1,$owner);
105 %typemap(out) ParaMEDMEM::MEDCouplingFieldDiscretization*
107 $result=convertFieldDiscretization($1,$owner);
110 %typemap(out) MEDCouplingFieldDiscretization*
112 $result=convertFieldDiscretization($1,$owner);
117 %typemap(out) ParaMEDMEM::MEDCouplingMultiFields*
119 $result=convertMultiFields($1,$owner);
122 %typemap(out) MEDCouplingMultiFields*
124 $result=convertMultiFields($1,$owner);
129 %init %{ import_array(); %}
132 %feature("autodoc", "1");
133 %feature("docstring");
135 %newobject ParaMEDMEM::MEDCouplingField::buildMeasureField;
136 %newobject ParaMEDMEM::MEDCouplingField::getLocalizationOfDiscr;
137 %newobject ParaMEDMEM::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
138 %newobject ParaMEDMEM::MEDCouplingFieldDouble::New;
139 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getArray;
140 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getEndArray;
141 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MergeFields;
142 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MeldFields;
143 %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct;
144 %newobject ParaMEDMEM::MEDCouplingFieldDouble::determinant;
145 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenValues;
146 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenVectors;
147 %newobject ParaMEDMEM::MEDCouplingFieldDouble::inverse;
148 %newobject ParaMEDMEM::MEDCouplingFieldDouble::trace;
149 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deviator;
150 %newobject ParaMEDMEM::MEDCouplingFieldDouble::magnitude;
151 %newobject ParaMEDMEM::MEDCouplingFieldDouble::maxPerTuple;
152 %newobject ParaMEDMEM::MEDCouplingFieldDouble::keepSelectedComponents;
153 %newobject ParaMEDMEM::MEDCouplingFieldDouble::extractSlice3D;
154 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DotFields;
155 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dot;
156 %newobject ParaMEDMEM::MEDCouplingFieldDouble::CrossProductFields;
157 %newobject ParaMEDMEM::MEDCouplingFieldDouble::crossProduct;
158 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MaxFields;
159 %newobject ParaMEDMEM::MEDCouplingFieldDouble::max;
160 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MinFields;
161 %newobject ParaMEDMEM::MEDCouplingFieldDouble::AddFields;
162 %newobject ParaMEDMEM::MEDCouplingFieldDouble::SubstractFields;
163 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MultiplyFields;
164 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DivideFields;
165 %newobject ParaMEDMEM::MEDCouplingFieldDouble::min;
166 %newobject ParaMEDMEM::MEDCouplingFieldDouble::negate;
167 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getIdsInRange;
168 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart;
169 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPartRange;
170 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__getitem__;
171 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__neg__;
172 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__add__;
173 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__sub__;
174 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__mul__;
175 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__div__;
176 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__pow__;
177 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__radd__;
178 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rsub__;
179 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rmul__;
180 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rdiv__;
181 %newobject ParaMEDMEM::MEDCouplingFieldDouble::clone;
182 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cloneWithMesh;
183 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy;
184 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
185 %newobject ParaMEDMEM::MEDCouplingFieldDouble::nodeToCellDiscretization;
186 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cellToNodeDiscretization;
187 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
188 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
189 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
190 %newobject ParaMEDMEM::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
191 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
192 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfNodesPerCell;
193 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfFacesPerCell;
194 %newobject ParaMEDMEM::MEDCouplingMesh::computeEffectiveNbOfNodesPerCell;
195 %newobject ParaMEDMEM::MEDCouplingMesh::buildPartRange;
196 %newobject ParaMEDMEM::MEDCouplingMesh::giveCellsWithType;
197 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
198 %newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
199 %newobject ParaMEDMEM::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
200 %newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
201 %newobject ParaMEDMEM::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
202 %newobject ParaMEDMEM::MEDCouplingMesh::mergeMyselfWith;
203 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic;
204 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic2;
205 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic3;
206 %newobject ParaMEDMEM::MEDCouplingMesh::getMeasureField;
207 %newobject ParaMEDMEM::MEDCouplingMesh::simplexize;
208 %newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured;
209 %newobject ParaMEDMEM::MEDCouplingMesh::MergeMeshes;
210 %newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer;
211 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellsInBoundingBox;
212 %newobject ParaMEDMEM::MEDCouplingPointSet::findBoundaryNodes;
213 %newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh;
214 %newobject ParaMEDMEM::MEDCouplingPointSet::MergeNodesArray;
215 %newobject ParaMEDMEM::MEDCouplingPointSet::buildPartOfMySelf2;
216 %newobject ParaMEDMEM::MEDCouplingPointSet::BuildInstanceFromMeshType;
217 %newobject ParaMEDMEM::MEDCouplingPointSet::zipConnectivityTraducer;
218 %newobject ParaMEDMEM::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
219 %newobject ParaMEDMEM::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
220 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellIdsLyingOnNodes;
221 %newobject ParaMEDMEM::MEDCouplingPointSet::deepCpyConnectivityOnly;
222 %newobject ParaMEDMEM::MEDCouplingPointSet::getBoundingBoxForBBTree;
223 %newobject ParaMEDMEM::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells;
224 %newobject ParaMEDMEM::MEDCouplingPointSet::__getitem__;
225 %newobject ParaMEDMEM::MEDCouplingUMesh::New;
226 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
227 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
228 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
229 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
230 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
231 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
232 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
233 %newobject ParaMEDMEM::MEDCouplingUMesh::explode3DMeshTo1D;
234 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
235 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
236 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
237 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
238 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
239 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
240 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
241 %newobject ParaMEDMEM::MEDCouplingUMesh::conformize2D;
242 %newobject ParaMEDMEM::MEDCouplingUMesh::colinearize2D;
243 %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
244 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
245 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
246 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
247 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
248 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
249 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
250 %newobject ParaMEDMEM::MEDCouplingUMesh::convertLinearCellsToQuadratic;
251 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
252 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
253 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
254 %newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField;
255 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner;
256 %newobject ParaMEDMEM::MEDCouplingUMesh::computePlaneEquationOf3DFaces;
257 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField;
258 %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
259 %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
260 %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
261 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
262 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
263 %newobject ParaMEDMEM::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
264 %newobject ParaMEDMEM::MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh;
265 %newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
266 %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
267 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis;
268 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsCrossingPlane;
269 %newobject ParaMEDMEM::MEDCouplingUMesh::convexEnvelop2D;
270 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
271 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf2DMesh;
272 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf3DMesh;
273 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
274 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
275 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic;
276 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
277 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
278 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::New;
279 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::getNodalConnectivity;
280 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
281 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::New;
282 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
283 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::computeDualMesh;
284 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
285 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::sortHexa8EachOther;
286 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
287 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
288 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::New;
289 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
290 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
291 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
292 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
293 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
294 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
295 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::buildStructuredSubPart;
296 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTUnstructured;
297 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTSubLevelMesh;
298 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
299 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
300 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh;
301 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
302 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
303 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
304 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
305 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
306 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
307 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
308 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
309 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
311 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
312 %feature("unref") MEDCouplingMesh "$this->decrRef();"
313 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
314 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
315 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
316 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
317 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
318 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
319 %feature("unref") MEDCouplingField "$this->decrRef();"
320 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
321 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
322 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
323 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
324 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
325 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
326 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
327 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
328 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
330 %rename(assign) *::operator=;
331 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
332 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
333 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
334 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
338 %rename (InterpKernelException) INTERP_KERNEL::Exception;
340 %include "MEDCouplingRefCountObject.i"
341 %include "MEDCouplingMemArray.i"
359 CONST_ON_TIME_INTERVAL = 7
360 } TypeOfTimeDiscretization;
368 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
369 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11
370 } MEDCouplingMeshType;
373 class DataArrayDouble;
374 class MEDCouplingUMesh;
375 class MEDCouplingFieldDouble;
377 %extend RefCountObject
379 std::string getHiddenCppPointer() const
381 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
386 %extend MEDCouplingGaussLocalization
388 std::string __str__() const throw(INTERP_KERNEL::Exception)
390 return self->getStringRepr();
393 std::string __repr__() const throw(INTERP_KERNEL::Exception)
395 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
396 oss << self->getStringRepr();
403 class MEDCouplingMesh : public RefCountObject, public TimeLabel
406 void setName(const std::string& name);
407 std::string getName() const;
408 void setDescription(const std::string& descr);
409 std::string getDescription() const;
410 void setTime(double val, int iteration, int order);
411 void setTimeUnit(const std::string& unit);
412 std::string getTimeUnit() const;
413 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
414 bool isStructured() const throw(INTERP_KERNEL::Exception);
415 virtual MEDCouplingMesh *deepCpy() const;
416 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
417 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
418 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
419 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
420 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
421 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
422 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
423 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
424 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
425 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
426 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
427 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
428 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
429 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
430 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
431 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
432 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
433 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
434 virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
435 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
436 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
437 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
438 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
439 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
440 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
442 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
443 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
444 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
445 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
446 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception);
447 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
448 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
449 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
450 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
451 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
452 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
453 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
454 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
455 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
456 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
457 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
458 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
461 std::string __str__() const throw(INTERP_KERNEL::Exception)
463 return self->simpleRepr();
466 PyObject *getTime() throw(INTERP_KERNEL::Exception)
469 double tmp0=self->getTime(tmp1,tmp2);
470 PyObject *res = PyList_New(3);
471 PyList_SetItem(res,0,SWIG_From_double(tmp0));
472 PyList_SetItem(res,1,SWIG_From_int(tmp1));
473 PyList_SetItem(res,2,SWIG_From_int(tmp2));
477 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
481 DataArrayDoubleTuple *aa;
482 std::vector<double> bb;
484 int spaceDim=self->getSpaceDimension();
485 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
486 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
487 return self->getCellContainingPoint(pos,eps);
490 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
494 DataArrayDoubleTuple *aa;
495 std::vector<double> bb;
497 int spaceDim=self->getSpaceDimension();
498 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
499 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
500 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
501 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
502 PyObject *ret=PyTuple_New(2);
503 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
504 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
508 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
510 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
511 int spaceDim=self->getSpaceDimension();
513 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
514 if (!SWIG_IsOK(res1))
517 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
518 int nbOfPoints=size/spaceDim;
521 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
523 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
527 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
529 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
530 da2->checkAllocated();
531 int size=da2->getNumberOfTuples();
532 int nbOfCompo=da2->getNumberOfComponents();
533 if(nbOfCompo!=spaceDim)
535 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
537 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
539 PyObject *ret=PyTuple_New(2);
540 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
541 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
545 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
549 DataArrayDoubleTuple *aa;
550 std::vector<double> bb;
552 int spaceDim=self->getSpaceDimension();
553 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
554 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
555 std::vector<int> elts;
556 self->getCellsContainingPoint(pos,eps,elts);
557 DataArrayInt *ret=DataArrayInt::New();
558 ret->alloc((int)elts.size(),1);
559 std::copy(elts.begin(),elts.end(),ret->getPointer());
560 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
563 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
565 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
566 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
567 self->getReverseNodalConnectivity(d0,d1);
568 PyObject *ret=PyTuple_New(2);
569 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
570 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
574 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
577 int v0; std::vector<int> v1;
578 const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
579 self->renumberCells(ids,check);
582 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
584 DataArrayInt *cellCor, *nodeCor;
585 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
586 PyObject *res = PyList_New(2);
587 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
588 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
592 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
594 DataArrayInt *cellCor=0,*nodeCor=0;
595 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
596 PyObject *res = PyList_New(2);
597 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
598 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
602 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
604 DataArrayInt *cellCor=0;
605 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
609 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
612 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
613 if (!SWIG_IsOK(res1))
616 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
617 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
621 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
623 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
624 da2->checkAllocated();
625 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
628 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
630 std::vector<int> conn;
631 self->getNodeIdsOfCell(cellId,conn);
632 return convertIntArrToPyList2(conn);
635 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
637 std::vector<double> coo;
638 self->getCoordinatesOfNode(nodeId,coo);
639 return convertDblArrToPyList2(coo);
642 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
646 DataArrayDoubleTuple *aa;
647 std::vector<double> bb;
649 int spaceDim=self->getSpaceDimension();
650 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
651 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
652 self->scale(pointPtr,factor);
655 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
657 int spaceDim=self->getSpaceDimension();
658 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
659 self->getBoundingBox(tmp);
660 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
664 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
667 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
668 PyObject *ret=PyTuple_New(2);
669 PyObject *ret0Py=ret0?Py_True:Py_False;
671 PyTuple_SetItem(ret,0,ret0Py);
672 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
676 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
678 int szArr,sw,iTypppArr;
679 std::vector<int> stdvecTyyppArr;
680 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
681 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
682 if(sw==3)//DataArrayInt
684 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
685 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
686 std::string name=argpt->getName();
688 ret->setName(name.c_str());
690 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
693 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
695 int szArr,sw,iTypppArr;
696 std::vector<int> stdvecTyyppArr;
698 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
699 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
700 if(sw==3)//DataArrayInt
702 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
703 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
704 std::string name=argpt->getName();
706 ret->setName(name.c_str());
709 PyObject *res = PyList_New(2);
710 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
711 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
712 PyList_SetItem(res,0,obj0);
713 PyList_SetItem(res,1,obj1);
717 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
721 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
722 PyObject *res = PyTuple_New(2);
723 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
726 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
728 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
729 PyTuple_SetItem(res,0,obj0);
730 PyTuple_SetItem(res,1,obj1);
734 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
736 std::vector<int> vals=self->getDistributionOfTypes();
738 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
739 PyObject *ret=PyList_New((int)vals.size()/3);
740 for(int j=0;j<(int)vals.size()/3;j++)
742 PyObject *ret1=PyList_New(3);
743 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
744 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
745 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
746 PyList_SetItem(ret,j,ret1);
751 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
753 std::vector<int> code;
754 std::vector<const DataArrayInt *> idsPerType;
755 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
756 convertPyToNewIntArr4(li,1,3,code);
757 return self->checkTypeConsistencyAndContig(code,idsPerType);
760 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
762 std::vector<int> code;
763 std::vector<DataArrayInt *> idsInPflPerType;
764 std::vector<DataArrayInt *> idsPerType;
765 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
766 PyObject *ret=PyTuple_New(3);
769 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
770 PyObject *ret0=PyList_New((int)code.size()/3);
771 for(int j=0;j<(int)code.size()/3;j++)
773 PyObject *ret00=PyList_New(3);
774 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
775 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
776 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
777 PyList_SetItem(ret0,j,ret00);
779 PyTuple_SetItem(ret,0,ret0);
781 PyObject *ret1=PyList_New(idsInPflPerType.size());
782 for(std::size_t j=0;j<idsInPflPerType.size();j++)
783 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
784 PyTuple_SetItem(ret,1,ret1);
785 int n=idsPerType.size();
786 PyObject *ret2=PyList_New(n);
788 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
789 PyTuple_SetItem(ret,2,ret2);
793 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
797 DataArrayDoubleTuple *aa;
798 std::vector<double> bb;
800 int spaceDim=self->getSpaceDimension();
801 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
802 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
803 self->translate(vectorPtr);
806 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
808 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
811 DataArrayDoubleTuple *aa;
812 std::vector<double> bb;
814 int spaceDim=self->getSpaceDimension();
815 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
816 self->rotate(centerPtr,0,alpha);
819 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
821 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
823 DataArrayDouble *a,*a2;
824 DataArrayDoubleTuple *aa,*aa2;
825 std::vector<double> bb,bb2;
827 int spaceDim=self->getSpaceDimension();
828 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
829 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
830 self->rotate(centerPtr,vectorPtr,alpha);
833 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
835 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
836 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
837 PyObject *res=PyList_New(result.size());
838 for(int i=0;iL!=result.end(); i++, iL++)
839 PyList_SetItem(res,i,PyInt_FromLong(*iL));
843 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
845 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
846 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
847 return MEDCouplingMesh::MergeMeshes(tmp);
853 //== MEDCouplingMesh End
855 %include "NormalizedGeometricTypes"
856 %include "MEDCouplingNatureOfFieldEnum"
860 class MEDCouplingNatureOfField
863 static const char *GetRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception);
864 static std::string GetReprNoThrow(NatureOfField nat);
865 static std::string GetAllPossibilitiesStr();
869 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
870 // include "MEDCouplingTimeDiscretization.i"
874 class MEDCouplingGaussLocalization
877 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
878 const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
879 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
880 INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
881 void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
882 int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
883 int getDimension() const throw(INTERP_KERNEL::Exception);
884 int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
885 std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
886 void checkCoherency() const throw(INTERP_KERNEL::Exception);
887 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception);
889 const std::vector<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
890 double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
891 const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
892 double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
893 const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
894 double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
895 void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
896 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
897 void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
898 void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
899 void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
900 void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
902 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
906 %include "MEDCouplingFieldDiscretization.i"
908 //== MEDCouplingPointSet
912 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
915 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
916 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
917 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
918 void zipCoords() throw(INTERP_KERNEL::Exception);
919 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
920 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
921 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
922 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
923 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
924 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
925 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
926 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
927 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
928 static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception);
929 virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
930 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
931 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
932 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
933 virtual DataArrayInt *findBoundaryNodes() const;
934 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
935 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
936 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
937 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
938 virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
939 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
942 std::string __str__() const throw(INTERP_KERNEL::Exception)
944 return self->simpleRepr();
947 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
950 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
951 PyObject *res = PyList_New(2);
952 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
953 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
957 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
959 DataArrayInt *comm, *commIndex;
960 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
961 PyObject *res = PyList_New(2);
962 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
963 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
967 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
969 DataArrayDouble *ret1=self->getCoords();
972 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
975 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
977 int szArr,sw,iTypppArr;
978 std::vector<int> stdvecTyyppArr;
979 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
980 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
981 if(sw==3)//DataArrayInt
983 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
984 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
985 std::string name=argpt->getName();
987 ret->setName(name.c_str());
989 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
992 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
994 int szArr,sw,iTypppArr;
995 std::vector<int> stdvecTyyppArr;
996 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
997 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
998 if(sw==3)//DataArrayInt
1000 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1001 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1002 std::string name=argpt->getName();
1004 ret->setName(name.c_str());
1006 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1009 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
1011 int szArr,sw,iTypppArr;
1012 std::vector<int> stdvecTyyppArr;
1013 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1014 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1015 if(sw==3)//DataArrayInt
1017 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1018 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1019 std::string name=argpt->getName();
1021 ret->setName(name.c_str());
1023 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1026 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1028 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1029 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1032 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1034 int szArr,sw,iTypppArr;
1035 std::vector<int> stdvecTyyppArr;
1036 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1037 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1038 if(sw==3)//DataArrayInt
1040 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1041 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1042 std::string name=argpt->getName();
1044 ret->setName(name.c_str());
1046 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1049 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1051 int szArr,sw,iTypppArr;
1052 std::vector<int> stdvecTyyppArr;
1053 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1054 self->renumberNodes(tmp,newNbOfNodes);
1057 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1059 int szArr,sw,iTypppArr;
1060 std::vector<int> stdvecTyyppArr;
1061 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1062 self->renumberNodes2(tmp,newNbOfNodes);
1065 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1067 int spaceDim=self->getSpaceDimension();
1069 DataArrayDouble *a,*a2;
1070 DataArrayDoubleTuple *aa,*aa2;
1071 std::vector<double> bb,bb2;
1073 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1074 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1075 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1076 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1077 std::vector<int> nodes;
1078 self->findNodesOnLine(p,v,eps,nodes);
1079 DataArrayInt *ret=DataArrayInt::New();
1080 ret->alloc((int)nodes.size(),1);
1081 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1082 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1084 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1086 int spaceDim=self->getSpaceDimension();
1088 DataArrayDouble *a,*a2;
1089 DataArrayDoubleTuple *aa,*aa2;
1090 std::vector<double> bb,bb2;
1092 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1093 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1094 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1095 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1096 std::vector<int> nodes;
1097 self->findNodesOnPlane(p,v,eps,nodes);
1098 DataArrayInt *ret=DataArrayInt::New();
1099 ret->alloc((int)nodes.size(),1);
1100 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1101 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1104 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1108 DataArrayDoubleTuple *aa;
1109 std::vector<double> bb;
1111 int spaceDim=self->getSpaceDimension();
1112 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1113 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1114 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1115 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1118 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1120 DataArrayInt *c=0,*cI=0;
1124 DataArrayDoubleTuple *aa;
1125 std::vector<double> bb;
1127 int spaceDim=self->getSpaceDimension();
1128 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1129 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1130 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1131 PyObject *ret=PyTuple_New(2);
1132 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1133 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1137 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1139 DataArrayInt *c=0,*cI=0;
1140 int spaceDim=self->getSpaceDimension();
1143 DataArrayDoubleTuple *aa;
1144 std::vector<double> bb;
1147 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1148 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1150 PyObject *ret=PyTuple_New(2);
1151 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1152 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1156 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1160 DataArrayDoubleTuple *aa;
1161 std::vector<double> bb;
1163 int spaceDim=self->getSpaceDimension();
1164 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1165 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1167 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1168 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1171 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1175 std::vector<int> multiVal;
1176 std::pair<int, std::pair<int,int> > slic;
1177 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1178 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1182 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1184 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1186 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1188 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1192 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1194 DataArrayInt *v0=0,*v1=0;
1195 self->findCommonCells(compType,startCellId,v0,v1);
1196 PyObject *res = PyList_New(2);
1197 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1198 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1203 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1206 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1207 if (!SWIG_IsOK(res1))
1210 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1211 self->renumberNodesInConn(tmp);
1215 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1217 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1218 da2->checkAllocated();
1219 self->renumberNodesInConn(da2->getConstPointer());
1223 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1226 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1227 PyObject *ret=PyTuple_New(2);
1228 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1229 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1233 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1235 DataArrayInt *ret=0;
1237 int szArr,sw,iTypppArr;
1238 std::vector<int> stdvecTyyppArr;
1239 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1240 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1244 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1248 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1249 PyObject *res = PyList_New(3);
1250 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1251 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1252 PyList_SetItem(res,2,SWIG_From_int(ret2));
1256 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1260 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1261 PyObject *res = PyList_New(3);
1262 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1263 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1264 PyList_SetItem(res,2,SWIG_From_int(ret2));
1268 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1271 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1272 if (!SWIG_IsOK(res1))
1275 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1276 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1280 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1282 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1283 da2->checkAllocated();
1284 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1288 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1292 std::vector<int> multiVal;
1293 std::pair<int, std::pair<int,int> > slic;
1294 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1295 int nbc=self->getNumberOfCells();
1296 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1303 std::ostringstream oss;
1304 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1305 throw INTERP_KERNEL::Exception(oss.str().c_str());
1308 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1313 int tmp=nbc+singleVal;
1314 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1318 std::ostringstream oss;
1319 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1320 throw INTERP_KERNEL::Exception(oss.str().c_str());
1326 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1330 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1335 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1336 daIntTyypp->checkAllocated();
1337 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1340 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1344 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1347 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1348 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1349 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1350 for(int i=0;i<sz;i++)
1351 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1354 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1357 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1359 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1360 std::vector<double> val3;
1361 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1362 "Rotate2DAlg",2,true,nbNodes);
1364 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1365 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1368 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1371 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1372 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1373 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1374 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1375 for(int i=0;i<sz;i++)
1376 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1379 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1382 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1384 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1385 std::vector<double> val3;
1386 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1387 "Rotate3DAlg",3,true,nbNodes);
1389 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1390 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1391 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1396 //== MEDCouplingPointSet End
1398 class MEDCouplingUMeshCell
1401 INTERP_KERNEL::NormalizedCellType getType() const;
1404 std::string __str__() const throw(INTERP_KERNEL::Exception)
1406 return self->repr();
1409 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1412 const int *r=self->getAllConn(ret2);
1413 PyObject *ret=PyTuple_New(ret2);
1414 for(int i=0;i<ret2;i++)
1415 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1421 class MEDCouplingUMeshCellIterator
1428 MEDCouplingUMeshCell *ret=self->nextt();
1430 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1433 PyErr_SetString(PyExc_StopIteration,"No more data.");
1440 class MEDCouplingUMeshCellByTypeIterator
1443 ~MEDCouplingUMeshCellByTypeIterator();
1448 MEDCouplingUMeshCellEntry *ret=self->nextt();
1450 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1453 PyErr_SetString(PyExc_StopIteration,"No more data.");
1460 class MEDCouplingUMeshCellByTypeEntry
1463 ~MEDCouplingUMeshCellByTypeEntry();
1466 MEDCouplingUMeshCellByTypeIterator *__iter__()
1468 return self->iterator();
1473 class MEDCouplingUMeshCellEntry
1476 INTERP_KERNEL::NormalizedCellType getType() const;
1477 int getNumberOfElems() const;
1480 MEDCouplingUMeshCellIterator *__iter__()
1482 return self->iterator();
1487 //== MEDCouplingUMesh
1489 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1492 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1493 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1494 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1495 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1496 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1497 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1498 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1499 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1500 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1501 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1502 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1503 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1504 void computeTypes() throw(INTERP_KERNEL::Exception);
1505 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1506 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1508 DataArrayInt *conformize2D(double eps) throw(INTERP_KERNEL::Exception);
1509 DataArrayInt *colinearize2D(double eps) throw(INTERP_KERNEL::Exception);
1510 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1511 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1512 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1513 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1514 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1515 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1516 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1517 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1518 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1519 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1520 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1521 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1522 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1523 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1524 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1525 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1526 bool isFullyQuadratic() const throw(INTERP_KERNEL::Exception);
1527 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1528 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1529 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1530 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1531 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1532 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1533 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1534 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1535 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1536 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1537 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1538 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1539 DataArrayDouble *computePlaneEquationOf3DFaces() const throw(INTERP_KERNEL::Exception);
1540 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1541 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1542 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1543 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1544 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1545 DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1546 DataArrayInt *buildUnionOf2DMesh() const throw(INTERP_KERNEL::Exception);
1547 DataArrayInt *buildUnionOf3DMesh() const throw(INTERP_KERNEL::Exception);
1548 DataArrayDouble *getBoundingBoxForBBTreeFast() const throw(INTERP_KERNEL::Exception);
1549 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1550 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1551 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);
1552 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1553 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1554 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1555 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1556 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1558 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1560 return MEDCouplingUMesh::New();
1563 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1565 return MEDCouplingUMesh::New(meshName,meshDim);
1568 std::string __str__() const throw(INTERP_KERNEL::Exception)
1570 return self->simpleRepr();
1573 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1575 std::ostringstream oss;
1576 self->reprQuickOverview(oss);
1580 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1582 return self->cellIterator();
1585 PyObject *getAllGeoTypesSorted() const throw(INTERP_KERNEL::Exception)
1587 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
1588 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1589 PyObject *res=PyList_New(result.size());
1590 for(int i=0;iL!=result.end(); i++, iL++)
1591 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1595 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1599 std::vector<int> multiVal;
1600 std::pair<int, std::pair<int,int> > slic;
1601 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1602 int nbc=self->getNumberOfCells();
1603 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1610 std::ostringstream oss;
1611 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1612 throw INTERP_KERNEL::Exception(oss.str().c_str());
1616 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1623 int tmp=nbc+singleVal;
1624 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1629 std::ostringstream oss;
1630 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1631 throw INTERP_KERNEL::Exception(oss.str().c_str());
1637 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1643 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1644 daIntTyypp->checkAllocated();
1645 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1649 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1653 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1657 std::vector<int> multiVal;
1658 std::pair<int, std::pair<int,int> > slic;
1659 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1660 int nbc=self->getNumberOfCells();
1661 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1668 std::ostringstream oss;
1669 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1670 throw INTERP_KERNEL::Exception(oss.str().c_str());
1674 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1681 int tmp=nbc+singleVal;
1682 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1687 std::ostringstream oss;
1688 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1689 throw INTERP_KERNEL::Exception(oss.str().c_str());
1695 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1700 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1706 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1707 daIntTyypp->checkAllocated();
1708 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1712 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1716 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1718 int szArr,sw,iTypppArr;
1719 std::vector<int> stdvecTyyppArr;
1720 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1723 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1724 throw INTERP_KERNEL::Exception(oss.str().c_str());
1726 self->insertNextCell(type,size,tmp);
1729 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1731 int szArr,sw,iTypppArr;
1732 std::vector<int> stdvecTyyppArr;
1733 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1734 self->insertNextCell(type,szArr,tmp);
1737 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1739 DataArrayInt *ret=self->getNodalConnectivity();
1744 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1746 DataArrayInt *ret=self->getNodalConnectivityIndex();
1752 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1754 int szArr,sw,iTypppArr;
1755 std::vector<int> stdvecTyyppArr;
1756 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1757 int nbOfDepthPeelingPerformed=0;
1758 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1759 PyObject *res=PyTuple_New(2);
1760 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1761 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1765 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1767 DataArrayInt *v0=0,*v1=0;
1768 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1769 PyObject *res = PyList_New(2);
1770 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1771 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1775 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1779 DataArrayDoubleTuple *aa;
1780 std::vector<double> bb;
1782 int nbOfCompo=self->getSpaceDimension();
1783 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1786 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1787 PyObject *ret=PyTuple_New(2);
1788 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1789 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1793 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1795 DataArrayInt *ret1=0;
1796 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1797 PyObject *ret=PyTuple_New(2);
1798 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1799 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1803 PyObject *tetrahedrize(int policy) throw(INTERP_KERNEL::Exception)
1806 DataArrayInt *ret1(0);
1807 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
1808 PyObject *ret=PyTuple_New(3);
1809 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
1810 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1811 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
1815 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1817 std::vector<int> cells;
1818 self->checkButterflyCells(cells,eps);
1819 DataArrayInt *ret=DataArrayInt::New();
1820 ret->alloc((int)cells.size(),1);
1821 std::copy(cells.begin(),cells.end(),ret->getPointer());
1822 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1825 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1827 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1829 PyObject *ret = PyList_New(sz);
1830 for(int i=0;i<sz;i++)
1831 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1835 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1837 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1838 int sz=retCpp.size();
1839 PyObject *ret=PyList_New(sz);
1840 for(int i=0;i<sz;i++)
1841 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1845 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1848 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1849 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1850 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1853 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1856 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1857 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1861 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1864 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1865 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1869 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1871 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1872 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1873 PyObject *ret=PyTuple_New(3);
1874 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1875 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1876 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1880 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1882 DataArrayInt *tmp0=0,*tmp1=0;
1883 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1884 PyObject *ret=PyTuple_New(2);
1885 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1886 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1890 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1894 std::vector<int> multiVal;
1895 std::pair<int, std::pair<int,int> > slic;
1896 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1897 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1901 return self->duplicateNodes(&singleVal,&singleVal+1);
1903 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
1905 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
1907 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1911 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
1915 std::vector<int> multiVal;
1916 std::pair<int, std::pair<int,int> > slic;
1917 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1918 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1922 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
1924 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
1926 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
1928 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1932 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
1935 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1936 DataArrayInt *tmp0,*tmp1=0;
1937 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
1938 PyObject *ret=PyTuple_New(2);
1939 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1940 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1944 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const throw(INTERP_KERNEL::Exception)
1946 DataArrayInt *ret0=0,*ret1=0;
1947 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
1948 PyObject *ret=PyTuple_New(2);
1949 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1950 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1954 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1956 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1957 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1958 DataArrayInt *ret1=0,*ret2=0;
1959 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
1960 PyObject *ret=PyTuple_New(3);
1961 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1962 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1963 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1967 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1969 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1970 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1971 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
1972 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1975 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
1978 std::vector<const MEDCouplingUMesh *> meshes;
1979 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1980 std::vector<DataArrayInt *> corr;
1981 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
1983 PyObject *ret1=PyList_New(sz);
1984 for(int i=0;i<sz;i++)
1985 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1986 PyObject *ret=PyList_New(2);
1987 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1988 PyList_SetItem(ret,1,ret1);
1992 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1994 std::vector<MEDCouplingUMesh *> meshes;
1995 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1996 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
1999 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
2001 std::vector<MEDCouplingUMesh *> meshes;
2002 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2003 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2006 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
2010 std::vector<int> multiVal;
2011 std::pair<int, std::pair<int,int> > slic;
2012 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2014 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2015 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2019 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2021 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2023 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2025 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2029 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2031 DataArrayInt *arrOut=0,*arrIndexOut=0;
2034 std::vector<int> multiVal;
2035 std::pair<int, std::pair<int,int> > slic;
2036 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2038 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2039 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2044 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2049 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2054 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2058 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2060 PyObject *ret=PyTuple_New(2);
2061 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2062 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2066 static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2068 DataArrayInt *arrOut=0,*arrIndexOut=0;
2069 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2070 PyObject *ret=PyTuple_New(2);
2071 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2072 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2076 static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2078 if(!PySlice_Check(slic))
2079 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !");
2080 Py_ssize_t strt=2,stp=2,step=2;
2081 PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
2083 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !");
2084 arrIndxIn->checkAllocated();
2085 if(arrIndxIn->getNumberOfComponents()!=1)
2086 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !");
2087 GetIndicesOfSlice(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !");
2088 DataArrayInt *arrOut=0,*arrIndexOut=0;
2089 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2090 PyObject *ret=PyTuple_New(2);
2091 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2092 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2096 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2097 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2098 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2100 DataArrayInt *arrOut=0,*arrIndexOut=0;
2103 std::vector<int> multiVal;
2104 std::pair<int, std::pair<int,int> > slic;
2105 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2107 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2108 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2113 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2118 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2123 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2127 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2129 PyObject *ret=PyTuple_New(2);
2130 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2131 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2135 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2136 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2140 std::vector<int> multiVal;
2141 std::pair<int, std::pair<int,int> > slic;
2142 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2144 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2145 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2150 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2155 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2160 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2164 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2168 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2172 DataArrayDoubleTuple *aa;
2173 std::vector<double> bb;
2175 int spaceDim=self->getSpaceDimension();
2176 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2177 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2179 std::vector<int> cells;
2180 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2181 DataArrayInt *ret=DataArrayInt::New();
2182 ret->alloc((int)cells.size(),1);
2183 std::copy(cells.begin(),cells.end(),ret->getPointer());
2184 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2187 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2191 DataArrayDoubleTuple *aa;
2192 std::vector<double> bb;
2194 int spaceDim=self->getSpaceDimension();
2195 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2196 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2197 self->orientCorrectly2DCells(v,polyOnly);
2200 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2202 std::vector<int> cells;
2203 self->arePolyhedronsNotCorrectlyOriented(cells);
2204 DataArrayInt *ret=DataArrayInt::New();
2205 ret->alloc((int)cells.size(),1);
2206 std::copy(cells.begin(),cells.end(),ret->getPointer());
2207 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2210 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2214 self->getFastAveragePlaneOfThis(vec,pos);
2216 std::copy(vec,vec+3,vals);
2217 std::copy(pos,pos+3,vals+3);
2218 return convertDblArrToPyListOfTuple(vals,3,2);
2221 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2223 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2224 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2225 return MEDCouplingUMesh::MergeUMeshes(tmp);
2228 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2231 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2232 PyObject *ret=PyTuple_New(2);
2233 PyObject *ret0Py=ret0?Py_True:Py_False;
2235 PyTuple_SetItem(ret,0,ret0Py);
2236 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2240 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2243 bool ret0=self->areCellsIncludedIn2(other,ret1);
2244 PyObject *ret=PyTuple_New(2);
2245 PyObject *ret0Py=ret0?Py_True:Py_False;
2247 PyTuple_SetItem(ret,0,ret0Py);
2248 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2252 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2254 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2255 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2256 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2257 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2258 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2259 PyObject *ret=PyTuple_New(5);
2260 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2261 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2262 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2263 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2264 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2268 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2270 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2271 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2272 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2273 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2274 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2275 PyObject *ret=PyTuple_New(5);
2276 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2277 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2278 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2279 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2280 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2284 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2286 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2287 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2288 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2289 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2290 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2291 PyObject *ret=PyTuple_New(5);
2292 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2293 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2294 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2295 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2296 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2300 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2302 DataArrayInt *neighbors=0,*neighborsIdx=0;
2303 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2304 PyObject *ret=PyTuple_New(2);
2305 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2306 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2310 PyObject *computeNeighborsOfNodes() const throw(INTERP_KERNEL::Exception)
2312 DataArrayInt *neighbors=0,*neighborsIdx=0;
2313 self->computeNeighborsOfNodes(neighbors,neighborsIdx);
2314 PyObject *ret=PyTuple_New(2);
2315 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2316 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2320 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2322 DataArrayInt *neighbors=0,*neighborsIdx=0;
2323 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2324 PyObject *ret=PyTuple_New(2);
2325 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2326 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2330 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2332 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2333 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2334 DataArrayInt *d2,*d3,*d4,*dd5;
2335 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2336 PyObject *ret=PyTuple_New(7);
2337 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2338 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2339 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2340 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2341 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2342 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2343 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2347 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2350 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2351 da->checkAllocated();
2352 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2355 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2358 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2359 da->checkAllocated();
2360 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2363 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2366 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2367 da->checkAllocated();
2368 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2371 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2374 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2375 da->checkAllocated();
2376 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2377 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2378 PyObject *res = PyList_New(result.size());
2379 for (int i=0;iL!=result.end(); i++, iL++)
2380 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2384 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2387 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2388 da->checkAllocated();
2389 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2390 ret->setName(da->getName().c_str());
2394 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2396 DataArrayInt *cellNb1=0,*cellNb2=0;
2397 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2398 PyObject *ret=PyTuple_New(3);
2399 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2400 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2401 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2405 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2407 int spaceDim=self->getSpaceDimension();
2409 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2411 DataArrayDouble *a,*a2;
2412 DataArrayDoubleTuple *aa,*aa2;
2413 std::vector<double> bb,bb2;
2415 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2416 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2417 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2418 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2420 DataArrayInt *cellIds=0;
2421 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2422 PyObject *ret=PyTuple_New(2);
2423 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2424 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2428 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2430 int spaceDim=self->getSpaceDimension();
2432 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2434 DataArrayDouble *a,*a2;
2435 DataArrayDoubleTuple *aa,*aa2;
2436 std::vector<double> bb,bb2;
2438 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2439 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2440 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2441 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2443 DataArrayInt *cellIds=0;
2444 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2445 PyObject *ret=PyTuple_New(2);
2446 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2447 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2451 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2453 int spaceDim=self->getSpaceDimension();
2455 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2457 DataArrayDouble *a,*a2;
2458 DataArrayDoubleTuple *aa,*aa2;
2459 std::vector<double> bb,bb2;
2461 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2462 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2463 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2464 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2465 return self->getCellIdsCrossingPlane(orig,vect,eps);
2468 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2472 std::vector<int> pos2;
2473 DataArrayInt *pos3=0;
2474 DataArrayIntTuple *pos4=0;
2475 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2480 self->convertToPolyTypes(&pos1,&pos1+1);
2487 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2492 self->convertToPolyTypes(pos3->begin(),pos3->end());
2496 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2500 void convertAllToPoly();
2501 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2502 bool unPolyze() throw(INTERP_KERNEL::Exception);
2503 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2504 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2505 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2508 //== MEDCouplingUMesh End
2510 //== MEDCouplingExtrudedMesh
2512 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2515 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2516 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2518 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2520 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2523 std::string __str__() const throw(INTERP_KERNEL::Exception)
2525 return self->simpleRepr();
2528 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2530 std::ostringstream oss;
2531 self->reprQuickOverview(oss);
2535 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2537 MEDCouplingUMesh *ret=self->getMesh2D();
2540 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2542 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2544 MEDCouplingUMesh *ret=self->getMesh1D();
2547 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2549 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2551 DataArrayInt *ret=self->getMesh3DIds();
2554 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2559 //== MEDCouplingExtrudedMesh End
2561 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2564 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2565 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2566 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2567 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2568 virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2569 virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
2572 virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2574 int szArr,sw,iTypppArr;
2575 std::vector<int> stdvecTyyppArr;
2576 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2577 self->insertNextCell(tmp,tmp+szArr);
2580 virtual DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2582 DataArrayInt *ret=self->getNodalConnectivity();
2583 if(ret) ret->incrRef();
2587 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2589 std::vector< const MEDCoupling1GTUMesh *> parts;
2590 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
2591 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
2596 //== MEDCoupling1SGTUMesh
2598 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2601 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2602 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2603 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2604 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2605 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2606 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2607 MEDCoupling1GTUMesh *computeDualMesh() const throw(INTERP_KERNEL::Exception);
2608 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const throw(INTERP_KERNEL::Exception);
2609 DataArrayInt *sortHexa8EachOther() throw(INTERP_KERNEL::Exception);
2612 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2614 return MEDCoupling1SGTUMesh::New(name,type);
2617 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2619 return MEDCoupling1SGTUMesh::New(m);
2622 std::string __str__() const throw(INTERP_KERNEL::Exception)
2624 return self->simpleRepr();
2627 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2629 std::ostringstream oss;
2630 self->reprQuickOverview(oss);
2634 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2636 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2637 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2638 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2641 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2643 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2644 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2645 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2650 //== MEDCoupling1SGTUMesh End
2652 //== MEDCoupling1DGTUMesh
2654 class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2657 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2658 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2659 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
2660 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2661 bool isPacked() const throw(INTERP_KERNEL::Exception);
2664 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2666 return MEDCoupling1DGTUMesh::New(name,type);
2669 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2671 return MEDCoupling1DGTUMesh::New(m);
2674 std::string __str__() const throw(INTERP_KERNEL::Exception)
2676 return self->simpleRepr();
2679 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2681 std::ostringstream oss;
2682 self->reprQuickOverview(oss);
2686 DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
2688 DataArrayInt *ret=self->getNodalConnectivityIndex();
2689 if(ret) ret->incrRef();
2693 PyObject *retrievePackedNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2695 DataArrayInt *ret1=0,*ret2=0;
2696 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
2697 PyObject *ret0Py=ret0?Py_True:Py_False;
2699 PyObject *ret=PyTuple_New(3);
2700 PyTuple_SetItem(ret,0,ret0Py);
2701 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2702 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2706 PyObject *copyWithNodalConnectivityPacked() const throw(INTERP_KERNEL::Exception)
2709 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
2710 PyObject *ret=PyTuple_New(2);
2711 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
2712 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
2713 PyTuple_SetItem(ret,1,ret1Py);
2717 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2719 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2720 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2721 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
2724 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2726 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2727 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2728 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
2731 static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt) throw(INTERP_KERNEL::Exception)
2733 std::vector<const ParaMEDMEM::DataArrayInt *> tmp;
2734 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2735 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
2740 //== MEDCoupling1DGTUMeshEnd
2742 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2745 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2746 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2747 int getNumberOfCellsOfSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2748 int getSpaceDimensionOnNodeStruct() const throw(INTERP_KERNEL::Exception);
2749 virtual std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2750 std::vector<int> getCellGridStructure() const throw(INTERP_KERNEL::Exception);
2751 MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception);
2752 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
2753 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2756 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const throw(INTERP_KERNEL::Exception)
2758 int tmpp1=-1,tmpp2=-1;
2759 std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
2760 std::vector< std::pair<int,int> > inp;
2764 for(int i=0;i<tmpp1;i++)
2765 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2770 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
2771 inp.resize(tmpp1/2);
2772 for(int i=0;i<tmpp1/2;i++)
2773 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2776 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
2777 return self->buildStructuredSubPart(inp);
2780 static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) throw(INTERP_KERNEL::Exception)
2782 int tmpp1=-1,tmpp2=-1;
2783 std::vector<int> tmp=fillArrayWithPyListInt2(part,tmpp1,tmpp2);
2784 std::vector< std::pair<int,int> > inp;
2788 for(int i=0;i<tmpp1;i++)
2789 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2794 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.BuildExplicitIdsFrom : invalid input size ! Must be even size !");
2795 inp.resize(tmpp1/2);
2796 for(int i=0;i<tmpp1/2;i++)
2797 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2800 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.BuildExplicitIdsFrom : invalid input size !");
2802 int szArr,sw,iTypppArr;
2803 std::vector<int> stdvecTyyppArr;
2804 const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
2805 std::vector<int> tmp5(tmp4,tmp4+szArr);
2807 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
2810 static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) throw(INTERP_KERNEL::Exception)
2812 int szArr,sw,iTypppArr;
2813 std::vector<int> stdvecTyyppArr;
2814 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2815 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
2818 static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2820 int szArr,sw,iTypppArr;
2821 std::vector<int> stdvecTyyppArr;
2822 const int *tmp(convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr));
2823 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
2826 static PyObject *IsPartStructured(PyObject *li, PyObject *st) throw(INTERP_KERNEL::Exception)
2828 int szArr,sw,iTypppArr;
2829 std::vector<int> stdvecTyyppArr;
2830 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2831 int szArr2,sw2,iTypppArr2;
2832 std::vector<int> stdvecTyyppArr2;
2833 const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
2834 std::vector<int> tmp3(tmp2,tmp2+szArr2);
2835 std::vector< std::pair<int,int> > partCompactFormat;
2836 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
2837 PyObject *ret=PyTuple_New(2);
2838 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
2839 PyTuple_SetItem(ret,0,ret0Py);
2840 PyObject *ret1Py=PyList_New(partCompactFormat.size());
2841 for(std::size_t i=0;i<partCompactFormat.size();i++)
2843 PyObject *tmp4=PyTuple_New(2);
2844 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
2845 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
2846 PyList_SetItem(ret1Py,i,tmp4);
2848 PyTuple_SetItem(ret,1,ret1Py);
2854 //== MEDCouplingCMesh
2856 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2859 static MEDCouplingCMesh *New();
2860 static MEDCouplingCMesh *New(const std::string& meshName);
2861 MEDCouplingCMesh *clone(bool recDeepCpy) const;
2862 void setCoords(const DataArrayDouble *coordsX,
2863 const DataArrayDouble *coordsY=0,
2864 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
2865 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
2869 return MEDCouplingCMesh::New();
2871 MEDCouplingCMesh(const std::string& meshName)
2873 return MEDCouplingCMesh::New(meshName);
2875 std::string __str__() const throw(INTERP_KERNEL::Exception)
2877 return self->simpleRepr();
2879 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2881 std::ostringstream oss;
2882 self->reprQuickOverview(oss);
2885 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
2887 DataArrayDouble *ret=self->getCoordsAt(i);
2895 //== MEDCouplingCMesh End
2897 //== MEDCouplingCurveLinearMesh
2899 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2902 static MEDCouplingCurveLinearMesh *New();
2903 static MEDCouplingCurveLinearMesh *New(const std::string& meshName);
2904 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
2905 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
2907 MEDCouplingCurveLinearMesh()
2909 return MEDCouplingCurveLinearMesh::New();
2911 MEDCouplingCurveLinearMesh(const std::string& meshName)
2913 return MEDCouplingCurveLinearMesh::New(meshName);
2915 std::string __str__() const throw(INTERP_KERNEL::Exception)
2917 return self->simpleRepr();
2919 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2921 std::ostringstream oss;
2922 self->reprQuickOverview(oss);
2925 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
2927 DataArrayDouble *ret=self->getCoords();
2932 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
2934 int szArr,sw,iTypppArr;
2935 std::vector<int> stdvecTyyppArr;
2936 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
2937 self->setNodeGridStructure(tmp,tmp+szArr);
2942 //== MEDCouplingCurveLinearMesh End
2945 namespace ParaMEDMEM
2947 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
2950 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
2951 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
2952 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2953 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2954 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
2955 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
2956 void setName(const char *name) throw(INTERP_KERNEL::Exception);
2957 std::string getDescription() const throw(INTERP_KERNEL::Exception);
2958 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
2959 std::string getName() const throw(INTERP_KERNEL::Exception);
2960 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
2961 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
2962 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
2963 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
2964 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
2965 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
2966 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
2967 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
2968 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
2969 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
2970 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
2971 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
2972 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
2973 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
2974 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
2975 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
2977 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
2979 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
2982 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
2985 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
2987 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
2990 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
2993 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
2995 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
2996 return convertIntArrToPyList3(ret);
2999 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
3002 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
3003 PyObject *ret=PyTuple_New(2);
3004 PyObject *ret0Py=ret0?Py_True:Py_False;
3006 PyTuple_SetItem(ret,0,ret0Py);
3007 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3011 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
3013 DataArrayInt *ret1=0;
3014 MEDCouplingMesh *ret0=0;
3016 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3017 if (!SWIG_IsOK(res1))
3020 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3021 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3025 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3027 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3028 da2->checkAllocated();
3029 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3031 PyObject *res = PyList_New(2);
3032 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3033 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3037 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
3039 DataArrayInt *ret1=0;
3041 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3042 PyObject *res=PyTuple_New(2);
3043 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3045 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3048 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3049 PyTuple_SetItem(res,1,res1);
3054 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3057 int v0; std::vector<int> v1;
3058 const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
3059 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3062 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3063 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3066 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3067 if (!SWIG_IsOK(res1))
3070 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3071 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3075 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3077 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3078 da2->checkAllocated();
3079 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3083 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3085 std::vector<int> tmp;
3086 self->getCellIdsHavingGaussLocalization(locId,tmp);
3087 DataArrayInt *ret=DataArrayInt::New();
3088 ret->alloc((int)tmp.size(),1);
3089 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3090 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3093 int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
3095 std::vector<int> inp0;
3096 convertPyToNewIntArr4(code,1,3,inp0);
3097 std::vector<const DataArrayInt *> inp1;
3098 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(idsPerType,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",inp1);
3099 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3104 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3107 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3108 static MEDCouplingFieldTemplate *New(TypeOfField type);
3109 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3110 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3113 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3115 return MEDCouplingFieldTemplate::New(f);
3118 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3120 return MEDCouplingFieldTemplate::New(type);
3123 std::string __str__() const throw(INTERP_KERNEL::Exception)
3125 return self->simpleRepr();
3128 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3130 std::ostringstream oss;
3131 self->reprQuickOverview(oss);
3137 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3140 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3141 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3142 void setTimeUnit(const std::string& unit);
3143 std::string getTimeUnit() const;
3144 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3145 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3146 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3147 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3148 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3149 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
3150 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3151 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3152 MEDCouplingFieldDouble *deepCpy() const;
3153 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3154 MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
3155 MEDCouplingFieldDouble *cellToNodeDiscretization() const throw(INTERP_KERNEL::Exception);
3156 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3157 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3158 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3159 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3160 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3161 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3162 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3163 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3164 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3165 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3166 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3167 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3168 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3169 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3170 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3171 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3172 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3173 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3174 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3175 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3176 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3177 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3178 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3179 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3180 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3181 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3182 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3183 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3184 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3185 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3186 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3187 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3188 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3189 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3190 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3191 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3192 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3193 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3194 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3195 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3196 void fillFromAnalytic(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3197 void fillFromAnalytic2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3198 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3199 void applyFunc(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3200 void applyFunc2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3201 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3202 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3203 void applyFunc(const std::string& func) throw(INTERP_KERNEL::Exception);
3204 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
3205 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
3206 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3207 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3208 double getMinValue() const throw(INTERP_KERNEL::Exception);
3209 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3210 double norm2() const throw(INTERP_KERNEL::Exception);
3211 double normMax() const throw(INTERP_KERNEL::Exception);
3212 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3213 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3214 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3215 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3216 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3217 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3218 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3219 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3220 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3221 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3222 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3223 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3224 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3225 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3226 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3227 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3228 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3229 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3230 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3231 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3232 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3233 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3235 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3237 return MEDCouplingFieldDouble::New(type,td);
3240 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3242 return MEDCouplingFieldDouble::New(ft,td);
3245 std::string __str__() const throw(INTERP_KERNEL::Exception)
3247 return self->simpleRepr();
3250 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3252 std::ostringstream oss;
3253 self->reprQuickOverview(oss);
3257 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3259 DataArrayDouble *ret=self->getArray();
3265 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3267 std::vector<DataArrayDouble *> arrs=self->getArrays();
3268 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3272 PyObject *ret=PyTuple_New(sz);
3273 for(int i=0;i<sz;i++)
3276 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3278 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3283 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3285 std::vector<const DataArrayDouble *> tmp;
3286 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3288 std::vector<DataArrayDouble *> arrs(sz);
3289 for(int i=0;i<sz;i++)
3290 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3291 self->setArrays(arrs);
3294 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3296 DataArrayDouble *ret=self->getEndArray();
3302 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3306 DataArrayDoubleTuple *aa;
3307 std::vector<double> bb;
3309 const MEDCouplingMesh *mesh=self->getMesh();
3311 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3312 int spaceDim=mesh->getSpaceDimension();
3313 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3314 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3316 int sz=self->getNumberOfComponents();
3317 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3318 self->getValueOn(spaceLoc,res);
3319 return convertDblArrToPyList(res,sz);
3322 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3324 int sz=self->getNumberOfComponents();
3325 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3326 self->getValueOnPos(i,j,k,res);
3327 return convertDblArrToPyList(res,sz);
3330 DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
3332 const MEDCouplingMesh *mesh(self->getMesh());
3334 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3337 double v0; ParaMEDMEM::DataArrayDouble *v1(0); ParaMEDMEM::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
3338 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
3339 mesh->getSpaceDimension(),true,nbPts);
3340 return self->getValueOnMulti(inp,nbPts);
3343 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3347 DataArrayDoubleTuple *aa;
3348 std::vector<double> bb;
3350 const MEDCouplingMesh *mesh=self->getMesh();
3352 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3353 int spaceDim=mesh->getSpaceDimension();
3354 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3355 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3358 int sz=self->getNumberOfComponents();
3359 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3360 self->getValueOn(spaceLoc,time,res);
3361 return convertDblArrToPyList(res,sz);
3364 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3366 if(self->getArray()!=0)
3367 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3370 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3371 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3372 self->setArray(arr);
3376 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3379 double tmp0=self->getTime(tmp1,tmp2);
3380 PyObject *res = PyList_New(3);
3381 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3382 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3383 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3387 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3390 double tmp0=self->getStartTime(tmp1,tmp2);
3391 PyObject *res = PyList_New(3);
3392 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3393 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3394 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3398 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3401 double tmp0=self->getEndTime(tmp1,tmp2);
3402 PyObject *res = PyList_New(3);
3403 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3404 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3405 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3408 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3410 int sz=self->getNumberOfComponents();
3411 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3412 self->accumulate(tmp);
3413 return convertDblArrToPyList(tmp,sz);
3415 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3417 int sz=self->getNumberOfComponents();
3418 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3419 self->integral(isWAbs,tmp);
3420 return convertDblArrToPyList(tmp,sz);
3422 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3424 int sz=self->getNumberOfComponents();
3425 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3426 self->getWeightedAverageValue(tmp,isWAbs);
3427 return convertDblArrToPyList(tmp,sz);
3429 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3431 int sz=self->getNumberOfComponents();
3432 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3434 return convertDblArrToPyList(tmp,sz);
3436 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3438 int sz=self->getNumberOfComponents();
3439 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3441 return convertDblArrToPyList(tmp,sz);
3443 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3445 int szArr,sw,iTypppArr;
3446 std::vector<int> stdvecTyyppArr;
3447 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3448 self->renumberCells(tmp,check);
3451 void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3453 int szArr,sw,iTypppArr;
3454 std::vector<int> stdvecTyyppArr;
3455 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3456 self->renumberCellsWithoutMesh(tmp,check);
3459 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3461 int szArr,sw,iTypppArr;
3462 std::vector<int> stdvecTyyppArr;
3463 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3464 self->renumberNodes(tmp,eps);
3467 void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3469 int szArr,sw,iTypppArr;
3470 std::vector<int> stdvecTyyppArr;
3471 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3472 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
3475 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3479 std::vector<int> multiVal;
3480 std::pair<int, std::pair<int,int> > slic;
3481 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3482 const MEDCouplingMesh *mesh=self->getMesh();
3484 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3485 int nbc=mesh->getNumberOfCells();
3486 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3493 std::ostringstream oss;
3494 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3495 throw INTERP_KERNEL::Exception(oss.str().c_str());
3498 return self->buildSubPart(&singleVal,&singleVal+1);
3503 int tmp=nbc+singleVal;
3504 return self->buildSubPart(&tmp,&tmp+1);
3508 std::ostringstream oss;
3509 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3510 throw INTERP_KERNEL::Exception(oss.str().c_str());
3516 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3520 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3525 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3526 daIntTyypp->checkAllocated();
3527 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3530 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3534 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3536 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";
3537 if(PyTuple_Check(li))
3539 Py_ssize_t sz=PyTuple_Size(li);
3541 throw INTERP_KERNEL::Exception(msg);
3542 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3545 std::vector<int> multiVal;
3546 std::pair<int, std::pair<int,int> > slic;
3547 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3548 if(!self->getArray())
3549 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3551 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3552 catch(INTERP_KERNEL::Exception& e)
3553 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3554 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3555 DataArrayDouble *ret0Arr=ret0->getArray();
3557 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3562 std::vector<int> v2(1,singleVal);
3563 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3564 ret0->setArray(aarr);
3569 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3570 ret0->setArray(aarr);
3575 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3576 std::vector<int> v2(nbOfComp);
3577 for(int i=0;i<nbOfComp;i++)
3578 v2[i]=slic.first+i*slic.second.second;
3579 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3580 ret0->setArray(aarr);
3584 throw INTERP_KERNEL::Exception(msg);
3589 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3592 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3595 double r1=self->getMaxValue2(tmp);
3596 PyObject *ret=PyTuple_New(2);
3597 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3598 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3602 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3605 double r1=self->getMinValue2(tmp);
3606 PyObject *ret=PyTuple_New(2);
3607 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3608 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3612 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3614 std::vector<int> tmp;
3615 convertPyToNewIntArr3(li,tmp);
3616 return self->keepSelectedComponents(tmp);
3619 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3621 std::vector<int> tmp;
3622 convertPyToNewIntArr3(li,tmp);
3623 self->setSelectedComponents(f,tmp);
3626 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3629 DataArrayDouble *a,*a2;
3630 DataArrayDoubleTuple *aa,*aa2;
3631 std::vector<double> bb,bb2;
3634 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
3635 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
3636 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3637 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3639 return self->extractSlice3D(orig,vect,eps);
3642 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3644 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
3647 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3649 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
3652 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3654 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.";
3655 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
3658 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3660 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3662 return (*self)-(*other);
3664 throw INTERP_KERNEL::Exception(msg);
3669 DataArrayDoubleTuple *aa;
3670 std::vector<double> bb;
3672 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3677 if(!self->getArray())
3678 throw INTERP_KERNEL::Exception(msg2);
3679 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3680 ret->applyLin(1.,-val);
3681 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3682 ret2->setArray(ret);
3687 if(!self->getArray())
3688 throw INTERP_KERNEL::Exception(msg2);
3689 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
3690 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3691 ret2->setArray(ret);
3696 if(!self->getArray())
3697 throw INTERP_KERNEL::Exception(msg2);
3698 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3699 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3700 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3701 ret2->setArray(ret);
3706 if(!self->getArray())
3707 throw INTERP_KERNEL::Exception(msg2);
3708 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3709 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3710 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3711 ret2->setArray(ret);
3715 { throw INTERP_KERNEL::Exception(msg); }
3719 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3721 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
3724 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3726 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
3729 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3731 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
3734 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3736 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.";
3737 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
3740 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3742 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3744 return (*self)/(*other);
3746 throw INTERP_KERNEL::Exception(msg);
3751 DataArrayDoubleTuple *aa;
3752 std::vector<double> bb;
3754 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3760 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
3761 if(!self->getArray())
3762 throw INTERP_KERNEL::Exception(msg2);
3763 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3764 ret->applyLin(1./val,0);
3765 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3766 ret2->setArray(ret);
3771 if(!self->getArray())
3772 throw INTERP_KERNEL::Exception(msg2);
3773 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
3774 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3775 ret2->setArray(ret);
3780 if(!self->getArray())
3781 throw INTERP_KERNEL::Exception(msg2);
3782 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3783 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3784 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3785 ret2->setArray(ret);
3790 if(!self->getArray())
3791 throw INTERP_KERNEL::Exception(msg2);
3792 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3793 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3794 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3795 ret2->setArray(ret);
3799 { throw INTERP_KERNEL::Exception(msg); }
3803 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3805 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
3808 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3810 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.";
3811 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
3814 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3816 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3818 return (*self)^(*other);
3820 throw INTERP_KERNEL::Exception(msg);
3825 DataArrayDoubleTuple *aa;
3826 std::vector<double> bb;
3828 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3833 if(!self->getArray())
3834 throw INTERP_KERNEL::Exception(msg2);
3835 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3837 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3838 ret2->setArray(ret);
3843 if(!self->getArray())
3844 throw INTERP_KERNEL::Exception(msg2);
3845 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
3846 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3847 ret2->setArray(ret);
3852 if(!self->getArray())
3853 throw INTERP_KERNEL::Exception(msg2);
3854 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3855 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3856 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3857 ret2->setArray(ret);
3862 if(!self->getArray())
3863 throw INTERP_KERNEL::Exception(msg2);
3864 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3865 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3866 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3867 ret2->setArray(ret);
3871 { throw INTERP_KERNEL::Exception(msg); }
3875 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
3877 return self->negate();
3880 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3882 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.";
3883 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
3886 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3888 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3892 Py_XINCREF(trueSelf);
3896 throw INTERP_KERNEL::Exception(msg);
3901 DataArrayDoubleTuple *aa;
3902 std::vector<double> bb;
3904 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3909 if(!self->getArray())
3910 throw INTERP_KERNEL::Exception(msg2);
3911 self->getArray()->applyLin(1.,val);
3912 Py_XINCREF(trueSelf);
3917 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3920 Py_XINCREF(trueSelf);
3925 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3926 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3927 ret2->setArray(aaa);
3929 Py_XINCREF(trueSelf);
3934 if(!self->getArray())
3935 throw INTERP_KERNEL::Exception(msg2);
3936 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3937 self->getArray()->addEqual(aaa);
3938 Py_XINCREF(trueSelf);
3942 { throw INTERP_KERNEL::Exception(msg); }
3946 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3948 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.";
3949 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
3952 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3954 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3958 Py_XINCREF(trueSelf);
3962 throw INTERP_KERNEL::Exception(msg);
3967 DataArrayDoubleTuple *aa;
3968 std::vector<double> bb;
3970 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3975 if(!self->getArray())
3976 throw INTERP_KERNEL::Exception(msg2);
3977 self->getArray()->applyLin(1.,-val);
3978 Py_XINCREF(trueSelf);
3983 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3986 Py_XINCREF(trueSelf);
3991 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3992 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3993 ret2->setArray(aaa);
3995 Py_XINCREF(trueSelf);
4000 if(!self->getArray())
4001 throw INTERP_KERNEL::Exception(msg2);
4002 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4003 self->getArray()->substractEqual(aaa);
4004 Py_XINCREF(trueSelf);
4008 { throw INTERP_KERNEL::Exception(msg); }
4012 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4014 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.";
4015 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4018 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4020 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4024 Py_XINCREF(trueSelf);
4028 throw INTERP_KERNEL::Exception(msg);
4033 DataArrayDoubleTuple *aa;
4034 std::vector<double> bb;
4036 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4041 if(!self->getArray())
4042 throw INTERP_KERNEL::Exception(msg2);
4043 self->getArray()->applyLin(val,0);
4044 Py_XINCREF(trueSelf);
4049 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4052 Py_XINCREF(trueSelf);
4057 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4058 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4059 ret2->setArray(aaa);
4061 Py_XINCREF(trueSelf);
4066 if(!self->getArray())
4067 throw INTERP_KERNEL::Exception(msg2);
4068 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4069 self->getArray()->multiplyEqual(aaa);
4070 Py_XINCREF(trueSelf);
4074 { throw INTERP_KERNEL::Exception(msg); }
4078 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4080 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.";
4081 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4084 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4086 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4090 Py_XINCREF(trueSelf);
4094 throw INTERP_KERNEL::Exception(msg);
4099 DataArrayDoubleTuple *aa;
4100 std::vector<double> bb;
4102 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4108 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4109 if(!self->getArray())
4110 throw INTERP_KERNEL::Exception(msg2);
4111 self->getArray()->applyLin(1./val,0);
4112 Py_XINCREF(trueSelf);
4117 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4120 Py_XINCREF(trueSelf);
4125 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4126 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4127 ret2->setArray(aaa);
4129 Py_XINCREF(trueSelf);
4134 if(!self->getArray())
4135 throw INTERP_KERNEL::Exception(msg2);
4136 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4137 self->getArray()->divideEqual(aaa);
4138 Py_XINCREF(trueSelf);
4142 { throw INTERP_KERNEL::Exception(msg); }
4146 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4148 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.";
4149 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4152 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4154 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4158 Py_XINCREF(trueSelf);
4162 throw INTERP_KERNEL::Exception(msg);
4167 DataArrayDoubleTuple *aa;
4168 std::vector<double> bb;
4170 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4175 if(!self->getArray())
4176 throw INTERP_KERNEL::Exception(msg2);
4177 self->getArray()->applyPow(val);
4178 Py_XINCREF(trueSelf);
4183 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4186 Py_XINCREF(trueSelf);
4191 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4192 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4193 ret2->setArray(aaa);
4195 Py_XINCREF(trueSelf);
4200 if(!self->getArray())
4201 throw INTERP_KERNEL::Exception(msg2);
4202 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4203 self->getArray()->powEqual(aaa);
4204 Py_XINCREF(trueSelf);
4208 { throw INTERP_KERNEL::Exception(msg); }
4212 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4214 std::vector<const MEDCouplingFieldDouble *> tmp;
4215 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4216 return MEDCouplingFieldDouble::MergeFields(tmp);
4219 static void WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
4221 std::vector<const MEDCouplingFieldDouble *> tmp;
4222 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4223 MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4228 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4231 int getNumberOfFields() const;
4232 MEDCouplingMultiFields *deepCpy() const;
4233 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4234 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4235 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4236 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4237 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4240 std::string __str__() const throw(INTERP_KERNEL::Exception)
4242 return self->simpleRepr();
4244 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4246 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4247 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4249 std::vector<MEDCouplingFieldDouble *> fs(sz);
4250 for(int i=0;i<sz;i++)
4251 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4252 return MEDCouplingMultiFields::New(fs);
4254 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4256 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4257 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4259 std::vector<MEDCouplingFieldDouble *> fs(sz);
4260 for(int i=0;i<sz;i++)
4261 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4262 return MEDCouplingMultiFields::New(fs);
4264 PyObject *getFields() const
4266 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4267 int sz=fields.size();
4268 PyObject *res = PyList_New(sz);
4269 for(int i=0;i<sz;i++)
4273 fields[i]->incrRef();
4274 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4278 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4283 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4285 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4289 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4292 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4294 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4296 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4298 PyObject *res = PyList_New(sz);
4299 for(int i=0;i<sz;i++)
4304 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4308 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4313 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4315 std::vector<int> refs;
4316 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4318 PyObject *res = PyList_New(sz);
4319 for(int i=0;i<sz;i++)
4324 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4328 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4332 PyObject *ret=PyTuple_New(2);
4333 PyTuple_SetItem(ret,0,res);
4334 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4337 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4339 std::vector<DataArrayDouble *> ms=self->getArrays();
4341 PyObject *res = PyList_New(sz);
4342 for(int i=0;i<sz;i++)
4347 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4351 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4356 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4358 std::vector< std::vector<int> > refs;
4359 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4361 PyObject *res = PyList_New(sz);
4362 PyObject *res2 = PyList_New(sz);
4363 for(int i=0;i<sz;i++)
4368 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4372 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4374 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4377 PyObject *ret=PyTuple_New(2);
4378 PyTuple_SetItem(ret,0,res);
4379 PyTuple_SetItem(ret,1,res2);
4385 class MEDCouplingDefinitionTime
4388 MEDCouplingDefinitionTime();
4389 void assign(const MEDCouplingDefinitionTime& other);
4390 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4391 double getTimeResolution() const;
4392 std::vector<double> getHotSpotsTime() const;
4395 std::string __str__() const throw(INTERP_KERNEL::Exception)
4397 std::ostringstream oss;
4398 self->appendRepr(oss);
4402 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4404 int meshId,arrId,arrIdInField,fieldId;
4405 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4406 PyObject *res=PyList_New(4);
4407 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4408 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4409 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4410 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4414 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4416 int meshId,arrId,arrIdInField,fieldId;
4417 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4418 PyObject *res=PyList_New(4);
4419 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4420 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4421 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4422 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4428 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4431 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4432 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4436 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4438 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4439 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4441 std::vector<MEDCouplingFieldDouble *> fs(sz);
4442 for(int i=0;i<sz;i++)
4443 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4444 return MEDCouplingFieldOverTime::New(fs);
4446 std::string __str__() const throw(INTERP_KERNEL::Exception)
4448 return self->simpleRepr();
4450 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4452 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4453 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4455 std::vector<MEDCouplingFieldDouble *> fs(sz);
4456 for(int i=0;i<sz;i++)
4457 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4458 return MEDCouplingFieldOverTime::New(fs);
4466 __filename=os.environ.get('PYTHONSTARTUP')
4467 if __filename and os.path.isfile(__filename):
4468 execfile(__filename)