1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
27 #include "MEDCouplingMemArray.hxx"
28 #include "MEDCouplingUMesh.hxx"
29 #include "MEDCouplingExtrudedMesh.hxx"
30 #include "MEDCouplingCMesh.hxx"
31 #include "MEDCouplingIMesh.hxx"
32 #include "MEDCouplingCurveLinearMesh.hxx"
33 #include "MEDCoupling1GTUMesh.hxx"
34 #include "MEDCouplingField.hxx"
35 #include "MEDCouplingFieldDouble.hxx"
36 #include "MEDCouplingFieldTemplate.hxx"
37 #include "MEDCouplingGaussLocalization.hxx"
38 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
39 #include "MEDCouplingMultiFields.hxx"
40 #include "MEDCouplingFieldOverTime.hxx"
41 #include "MEDCouplingDefinitionTime.hxx"
42 #include "MEDCouplingFieldDiscretization.hxx"
43 #include "MEDCouplingCartesianAMRMesh.hxx"
44 #include "MEDCouplingTypemaps.i"
46 #include "InterpKernelAutoPtr.hxx"
48 using namespace ParaMEDMEM;
49 using namespace INTERP_KERNEL;
53 %template(ivec) std::vector<int>;
54 %template(dvec) std::vector<double>;
55 %template(svec) std::vector<std::string>;
58 %typemap(out) ParaMEDMEM::MEDCouplingMesh*
60 $result=convertMesh($1,$owner);
63 %typemap(out) MEDCouplingMesh*
65 $result=convertMesh($1,$owner);
70 %typemap(out) ParaMEDMEM::MEDCouplingPointSet*
72 $result=convertMesh($1,$owner);
75 %typemap(out) MEDCouplingPointSet*
77 $result=convertMesh($1,$owner);
83 %typemap(out) ParaMEDMEM::MEDCoupling1GTUMesh*
85 $result=convertMesh($1,$owner);
88 %typemap(out) MEDCoupling1GTUMesh*
90 $result=convertMesh($1,$owner);
95 %typemap(out) ParaMEDMEM::MEDCouplingStructuredMesh*
97 $result=convertMesh($1,$owner);
100 %typemap(out) MEDCouplingStructuredMesh*
102 $result=convertMesh($1,$owner);
107 %typemap(out) ParaMEDMEM::MEDCouplingFieldDiscretization*
109 $result=convertFieldDiscretization($1,$owner);
112 %typemap(out) MEDCouplingFieldDiscretization*
114 $result=convertFieldDiscretization($1,$owner);
119 %typemap(out) ParaMEDMEM::MEDCouplingMultiFields*
121 $result=convertMultiFields($1,$owner);
124 %typemap(out) MEDCouplingMultiFields*
126 $result=convertMultiFields($1,$owner);
131 %init %{ import_array(); %}
134 %feature("autodoc", "1");
135 %feature("docstring");
137 %newobject ParaMEDMEM::MEDCouplingField::buildMeasureField;
138 %newobject ParaMEDMEM::MEDCouplingField::getLocalizationOfDiscr;
139 %newobject ParaMEDMEM::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
140 %newobject ParaMEDMEM::MEDCouplingFieldDouble::New;
141 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getArray;
142 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getEndArray;
143 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MergeFields;
144 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MeldFields;
145 %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct;
146 %newobject ParaMEDMEM::MEDCouplingFieldDouble::determinant;
147 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenValues;
148 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenVectors;
149 %newobject ParaMEDMEM::MEDCouplingFieldDouble::inverse;
150 %newobject ParaMEDMEM::MEDCouplingFieldDouble::trace;
151 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deviator;
152 %newobject ParaMEDMEM::MEDCouplingFieldDouble::magnitude;
153 %newobject ParaMEDMEM::MEDCouplingFieldDouble::maxPerTuple;
154 %newobject ParaMEDMEM::MEDCouplingFieldDouble::keepSelectedComponents;
155 %newobject ParaMEDMEM::MEDCouplingFieldDouble::extractSlice3D;
156 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DotFields;
157 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dot;
158 %newobject ParaMEDMEM::MEDCouplingFieldDouble::CrossProductFields;
159 %newobject ParaMEDMEM::MEDCouplingFieldDouble::crossProduct;
160 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MaxFields;
161 %newobject ParaMEDMEM::MEDCouplingFieldDouble::max;
162 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MinFields;
163 %newobject ParaMEDMEM::MEDCouplingFieldDouble::AddFields;
164 %newobject ParaMEDMEM::MEDCouplingFieldDouble::SubstractFields;
165 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MultiplyFields;
166 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DivideFields;
167 %newobject ParaMEDMEM::MEDCouplingFieldDouble::min;
168 %newobject ParaMEDMEM::MEDCouplingFieldDouble::negate;
169 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getIdsInRange;
170 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart;
171 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPartRange;
172 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__getitem__;
173 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__neg__;
174 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__add__;
175 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__sub__;
176 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__mul__;
177 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__div__;
178 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__pow__;
179 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__radd__;
180 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rsub__;
181 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rmul__;
182 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rdiv__;
183 %newobject ParaMEDMEM::MEDCouplingFieldDouble::clone;
184 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cloneWithMesh;
185 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy;
186 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
187 %newobject ParaMEDMEM::MEDCouplingFieldDouble::nodeToCellDiscretization;
188 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cellToNodeDiscretization;
189 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
190 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
191 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
192 %newobject ParaMEDMEM::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
193 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
194 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfNodesPerCell;
195 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfFacesPerCell;
196 %newobject ParaMEDMEM::MEDCouplingMesh::computeEffectiveNbOfNodesPerCell;
197 %newobject ParaMEDMEM::MEDCouplingMesh::buildPartRange;
198 %newobject ParaMEDMEM::MEDCouplingMesh::giveCellsWithType;
199 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
200 %newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
201 %newobject ParaMEDMEM::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
202 %newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
203 %newobject ParaMEDMEM::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
204 %newobject ParaMEDMEM::MEDCouplingMesh::mergeMyselfWith;
205 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic;
206 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic2;
207 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic3;
208 %newobject ParaMEDMEM::MEDCouplingMesh::getMeasureField;
209 %newobject ParaMEDMEM::MEDCouplingMesh::simplexize;
210 %newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured;
211 %newobject ParaMEDMEM::MEDCouplingMesh::MergeMeshes;
212 %newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer;
213 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellsInBoundingBox;
214 %newobject ParaMEDMEM::MEDCouplingPointSet::findBoundaryNodes;
215 %newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh;
216 %newobject ParaMEDMEM::MEDCouplingPointSet::MergeNodesArray;
217 %newobject ParaMEDMEM::MEDCouplingPointSet::buildPartOfMySelf2;
218 %newobject ParaMEDMEM::MEDCouplingPointSet::BuildInstanceFromMeshType;
219 %newobject ParaMEDMEM::MEDCouplingPointSet::zipConnectivityTraducer;
220 %newobject ParaMEDMEM::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
221 %newobject ParaMEDMEM::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
222 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellIdsLyingOnNodes;
223 %newobject ParaMEDMEM::MEDCouplingPointSet::deepCpyConnectivityOnly;
224 %newobject ParaMEDMEM::MEDCouplingPointSet::getBoundingBoxForBBTree;
225 %newobject ParaMEDMEM::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells;
226 %newobject ParaMEDMEM::MEDCouplingPointSet::__getitem__;
227 %newobject ParaMEDMEM::MEDCouplingUMesh::New;
228 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
229 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
230 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
231 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
232 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
233 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
234 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
235 %newobject ParaMEDMEM::MEDCouplingUMesh::explode3DMeshTo1D;
236 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
237 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
238 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
239 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
240 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
241 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
242 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
243 %newobject ParaMEDMEM::MEDCouplingUMesh::conformize2D;
244 %newobject ParaMEDMEM::MEDCouplingUMesh::colinearize2D;
245 %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
246 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
247 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
248 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
249 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
250 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
251 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
252 %newobject ParaMEDMEM::MEDCouplingUMesh::convertLinearCellsToQuadratic;
253 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
254 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
255 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
256 %newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField;
257 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner;
258 %newobject ParaMEDMEM::MEDCouplingUMesh::computePlaneEquationOf3DFaces;
259 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField;
260 %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
261 %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
262 %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
263 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
264 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
265 %newobject ParaMEDMEM::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
266 %newobject ParaMEDMEM::MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh;
267 %newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
268 %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
269 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis;
270 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsCrossingPlane;
271 %newobject ParaMEDMEM::MEDCouplingUMesh::convexEnvelop2D;
272 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
273 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf2DMesh;
274 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf3DMesh;
275 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
276 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
277 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic;
278 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
279 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
280 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::New;
281 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::getNodalConnectivity;
282 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
283 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::New;
284 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
285 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::computeDualMesh;
286 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
287 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::sortHexa8EachOther;
288 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
289 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
290 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::New;
291 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
292 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
293 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
294 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
295 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
296 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
297 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::buildStructuredSubPart;
298 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTUnstructured;
299 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTSubLevelMesh;
300 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
301 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
302 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh;
303 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
304 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
305 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
306 %newobject ParaMEDMEM::MEDCouplingIMesh::New;
307 %newobject ParaMEDMEM::MEDCouplingIMesh::convertToCartesian;
308 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
309 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
310 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
311 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
312 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
313 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
314 %newobject ParaMEDMEM::MEDCouplingCartesianAMRPatch::getMesh;
315 %newobject ParaMEDMEM::MEDCouplingCartesianAMRPatch::__getitem__;
316 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::New;
317 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::buildUnstructured;
318 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getGodFather;
319 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getFather;
320 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getPatch;
321 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::__getitem__;
323 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
324 %feature("unref") MEDCouplingMesh "$this->decrRef();"
325 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
326 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
327 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
328 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
329 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
330 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
331 %feature("unref") MEDCouplingIMesh "$this->decrRef();"
332 %feature("unref") MEDCouplingCurveLinearMesh "$this->decrRef();"
333 %feature("unref") MEDCouplingField "$this->decrRef();"
334 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
335 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
336 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
337 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
338 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
339 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
340 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
341 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
342 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
343 %feature("unref") MEDCouplingCartesianAMRMesh "$this->decrRef();"
344 %feature("unref") MEDCouplingCartesianAMRPatch "$this->decrRef();"
346 %rename(assign) *::operator=;
347 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
348 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
349 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
350 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
354 %rename (InterpKernelException) INTERP_KERNEL::Exception;
356 %include "MEDCouplingRefCountObject.i"
357 %include "MEDCouplingMemArray.i"
375 CONST_ON_TIME_INTERVAL = 7
376 } TypeOfTimeDiscretization;
384 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
385 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
387 } MEDCouplingMeshType;
390 class DataArrayDouble;
391 class MEDCouplingUMesh;
392 class MEDCouplingFieldDouble;
394 %extend RefCountObject
396 std::string getHiddenCppPointer() const
398 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
403 %extend MEDCouplingGaussLocalization
405 std::string __str__() const throw(INTERP_KERNEL::Exception)
407 return self->getStringRepr();
410 std::string __repr__() const throw(INTERP_KERNEL::Exception)
412 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
413 oss << self->getStringRepr();
420 class MEDCouplingMesh : public RefCountObject, public TimeLabel
423 void setName(const std::string& name);
424 std::string getName() const;
425 void setDescription(const std::string& descr);
426 std::string getDescription() const;
427 void setTime(double val, int iteration, int order);
428 void setTimeUnit(const std::string& unit);
429 std::string getTimeUnit() const;
430 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
431 bool isStructured() const throw(INTERP_KERNEL::Exception);
432 virtual MEDCouplingMesh *deepCpy() const;
433 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
434 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
435 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
436 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
437 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
438 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
439 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
440 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
441 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
442 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
443 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
444 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
445 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
446 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
447 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
448 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
449 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
450 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
451 virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
452 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
453 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
454 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
455 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
456 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
457 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
459 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
460 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
461 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
462 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
463 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception);
464 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
465 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
466 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
467 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
468 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
469 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
470 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
471 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
472 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
473 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
474 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
475 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
478 std::string __str__() const throw(INTERP_KERNEL::Exception)
480 return self->simpleRepr();
483 PyObject *getTime() throw(INTERP_KERNEL::Exception)
486 double tmp0=self->getTime(tmp1,tmp2);
487 PyObject *res = PyList_New(3);
488 PyList_SetItem(res,0,SWIG_From_double(tmp0));
489 PyList_SetItem(res,1,SWIG_From_int(tmp1));
490 PyList_SetItem(res,2,SWIG_From_int(tmp2));
494 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
498 DataArrayDoubleTuple *aa;
499 std::vector<double> bb;
501 int spaceDim=self->getSpaceDimension();
502 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
503 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
504 return self->getCellContainingPoint(pos,eps);
507 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
511 DataArrayDoubleTuple *aa;
512 std::vector<double> bb;
514 int spaceDim=self->getSpaceDimension();
515 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
516 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
517 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
518 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
519 PyObject *ret=PyTuple_New(2);
520 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
521 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
525 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
527 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
528 int spaceDim=self->getSpaceDimension();
530 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
531 if (!SWIG_IsOK(res1))
534 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
535 int nbOfPoints=size/spaceDim;
538 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
540 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
544 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
546 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
547 da2->checkAllocated();
548 int size=da2->getNumberOfTuples();
549 int nbOfCompo=da2->getNumberOfComponents();
550 if(nbOfCompo!=spaceDim)
552 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
554 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
556 PyObject *ret=PyTuple_New(2);
557 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
558 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
562 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
566 DataArrayDoubleTuple *aa;
567 std::vector<double> bb;
569 int spaceDim=self->getSpaceDimension();
570 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
571 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
572 std::vector<int> elts;
573 self->getCellsContainingPoint(pos,eps,elts);
574 DataArrayInt *ret=DataArrayInt::New();
575 ret->alloc((int)elts.size(),1);
576 std::copy(elts.begin(),elts.end(),ret->getPointer());
577 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
580 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
582 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
583 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
584 self->getReverseNodalConnectivity(d0,d1);
585 PyObject *ret=PyTuple_New(2);
586 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
587 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
591 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
594 int v0; std::vector<int> v1;
595 const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
596 self->renumberCells(ids,check);
599 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
601 DataArrayInt *cellCor, *nodeCor;
602 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
603 PyObject *res = PyList_New(2);
604 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
605 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
609 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
611 DataArrayInt *cellCor=0,*nodeCor=0;
612 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
613 PyObject *res = PyList_New(2);
614 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
615 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
619 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
621 DataArrayInt *cellCor=0;
622 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
626 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
629 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
630 if (!SWIG_IsOK(res1))
633 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
634 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
638 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
640 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
641 da2->checkAllocated();
642 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
645 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
647 std::vector<int> conn;
648 self->getNodeIdsOfCell(cellId,conn);
649 return convertIntArrToPyList2(conn);
652 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
654 std::vector<double> coo;
655 self->getCoordinatesOfNode(nodeId,coo);
656 return convertDblArrToPyList2(coo);
659 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
663 DataArrayDoubleTuple *aa;
664 std::vector<double> bb;
666 int spaceDim=self->getSpaceDimension();
667 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
668 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
669 self->scale(pointPtr,factor);
672 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
674 int spaceDim=self->getSpaceDimension();
675 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
676 self->getBoundingBox(tmp);
677 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
681 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
684 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
685 PyObject *ret=PyTuple_New(2);
686 PyObject *ret0Py=ret0?Py_True:Py_False;
688 PyTuple_SetItem(ret,0,ret0Py);
689 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
693 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
695 int szArr,sw,iTypppArr;
696 std::vector<int> stdvecTyyppArr;
697 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
698 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
699 if(sw==3)//DataArrayInt
701 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
702 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
703 std::string name=argpt->getName();
705 ret->setName(name.c_str());
707 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
710 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
712 int szArr,sw,iTypppArr;
713 std::vector<int> stdvecTyyppArr;
715 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
716 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
717 if(sw==3)//DataArrayInt
719 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
720 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
721 std::string name=argpt->getName();
723 ret->setName(name.c_str());
726 PyObject *res = PyList_New(2);
727 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
728 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
729 PyList_SetItem(res,0,obj0);
730 PyList_SetItem(res,1,obj1);
734 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
738 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
739 PyObject *res = PyTuple_New(2);
740 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
743 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
745 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
746 PyTuple_SetItem(res,0,obj0);
747 PyTuple_SetItem(res,1,obj1);
751 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
753 std::vector<int> vals=self->getDistributionOfTypes();
755 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
756 PyObject *ret=PyList_New((int)vals.size()/3);
757 for(int j=0;j<(int)vals.size()/3;j++)
759 PyObject *ret1=PyList_New(3);
760 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
761 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
762 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
763 PyList_SetItem(ret,j,ret1);
768 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
770 std::vector<int> code;
771 std::vector<const DataArrayInt *> idsPerType;
772 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
773 convertPyToNewIntArr4(li,1,3,code);
774 return self->checkTypeConsistencyAndContig(code,idsPerType);
777 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
779 std::vector<int> code;
780 std::vector<DataArrayInt *> idsInPflPerType;
781 std::vector<DataArrayInt *> idsPerType;
782 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
783 PyObject *ret=PyTuple_New(3);
786 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
787 PyObject *ret0=PyList_New((int)code.size()/3);
788 for(int j=0;j<(int)code.size()/3;j++)
790 PyObject *ret00=PyList_New(3);
791 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
792 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
793 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
794 PyList_SetItem(ret0,j,ret00);
796 PyTuple_SetItem(ret,0,ret0);
798 PyObject *ret1=PyList_New(idsInPflPerType.size());
799 for(std::size_t j=0;j<idsInPflPerType.size();j++)
800 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
801 PyTuple_SetItem(ret,1,ret1);
802 int n=idsPerType.size();
803 PyObject *ret2=PyList_New(n);
805 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
806 PyTuple_SetItem(ret,2,ret2);
810 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
814 DataArrayDoubleTuple *aa;
815 std::vector<double> bb;
817 int spaceDim=self->getSpaceDimension();
818 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
819 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
820 self->translate(vectorPtr);
823 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
825 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
828 DataArrayDoubleTuple *aa;
829 std::vector<double> bb;
831 int spaceDim=self->getSpaceDimension();
832 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
833 self->rotate(centerPtr,0,alpha);
836 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
838 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
840 DataArrayDouble *a,*a2;
841 DataArrayDoubleTuple *aa,*aa2;
842 std::vector<double> bb,bb2;
844 int spaceDim=self->getSpaceDimension();
845 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
846 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
847 self->rotate(centerPtr,vectorPtr,alpha);
850 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
852 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
853 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
854 PyObject *res=PyList_New(result.size());
855 for(int i=0;iL!=result.end(); i++, iL++)
856 PyList_SetItem(res,i,PyInt_FromLong(*iL));
860 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
862 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
863 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
864 return MEDCouplingMesh::MergeMeshes(tmp);
870 //== MEDCouplingMesh End
872 %include "NormalizedGeometricTypes"
873 %include "MEDCouplingNatureOfFieldEnum"
877 class MEDCouplingNatureOfField
880 static const char *GetRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception);
881 static std::string GetReprNoThrow(NatureOfField nat);
882 static std::string GetAllPossibilitiesStr();
886 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
887 // include "MEDCouplingTimeDiscretization.i"
891 class MEDCouplingGaussLocalization
894 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
895 const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
896 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
897 INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
898 void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
899 int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
900 int getDimension() const throw(INTERP_KERNEL::Exception);
901 int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
902 std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
903 void checkCoherency() const throw(INTERP_KERNEL::Exception);
904 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception);
906 const std::vector<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
907 double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
908 const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
909 double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
910 const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
911 double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
912 void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
913 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
914 void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
915 void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
916 void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
917 void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
919 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
923 %include "MEDCouplingFieldDiscretization.i"
925 //== MEDCouplingPointSet
929 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
932 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
933 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
934 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
935 void zipCoords() throw(INTERP_KERNEL::Exception);
936 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
937 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
938 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
939 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
940 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
941 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
942 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
943 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
944 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
945 static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception);
946 virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
947 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
948 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
949 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
950 virtual DataArrayInt *findBoundaryNodes() const;
951 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
952 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
953 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
954 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
955 virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
956 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
959 std::string __str__() const throw(INTERP_KERNEL::Exception)
961 return self->simpleRepr();
964 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
967 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
968 PyObject *res = PyList_New(2);
969 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
970 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
974 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
976 DataArrayInt *comm, *commIndex;
977 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
978 PyObject *res = PyList_New(2);
979 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
980 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
984 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
986 DataArrayDouble *ret1=self->getCoords();
989 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
992 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) 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->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
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 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) 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->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
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 *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
1028 int szArr,sw,iTypppArr;
1029 std::vector<int> stdvecTyyppArr;
1030 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1031 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1032 if(sw==3)//DataArrayInt
1034 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1035 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1036 std::string name=argpt->getName();
1038 ret->setName(name.c_str());
1040 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1043 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1045 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1046 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1049 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const 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 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1055 if(sw==3)//DataArrayInt
1057 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1058 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1059 std::string name=argpt->getName();
1061 ret->setName(name.c_str());
1063 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1066 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1068 int szArr,sw,iTypppArr;
1069 std::vector<int> stdvecTyyppArr;
1070 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1071 self->renumberNodes(tmp,newNbOfNodes);
1074 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1076 int szArr,sw,iTypppArr;
1077 std::vector<int> stdvecTyyppArr;
1078 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1079 self->renumberNodes2(tmp,newNbOfNodes);
1082 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1084 int spaceDim=self->getSpaceDimension();
1086 DataArrayDouble *a,*a2;
1087 DataArrayDoubleTuple *aa,*aa2;
1088 std::vector<double> bb,bb2;
1090 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1091 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1092 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1093 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1094 std::vector<int> nodes;
1095 self->findNodesOnLine(p,v,eps,nodes);
1096 DataArrayInt *ret=DataArrayInt::New();
1097 ret->alloc((int)nodes.size(),1);
1098 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1099 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1101 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1103 int spaceDim=self->getSpaceDimension();
1105 DataArrayDouble *a,*a2;
1106 DataArrayDoubleTuple *aa,*aa2;
1107 std::vector<double> bb,bb2;
1109 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1110 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1111 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1112 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1113 std::vector<int> nodes;
1114 self->findNodesOnPlane(p,v,eps,nodes);
1115 DataArrayInt *ret=DataArrayInt::New();
1116 ret->alloc((int)nodes.size(),1);
1117 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1118 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1121 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1125 DataArrayDoubleTuple *aa;
1126 std::vector<double> bb;
1128 int spaceDim=self->getSpaceDimension();
1129 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1130 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1131 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1132 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1135 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1137 DataArrayInt *c=0,*cI=0;
1141 DataArrayDoubleTuple *aa;
1142 std::vector<double> bb;
1144 int spaceDim=self->getSpaceDimension();
1145 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1146 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1147 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1148 PyObject *ret=PyTuple_New(2);
1149 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1150 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1154 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1156 DataArrayInt *c=0,*cI=0;
1157 int spaceDim=self->getSpaceDimension();
1160 DataArrayDoubleTuple *aa;
1161 std::vector<double> bb;
1164 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1165 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1167 PyObject *ret=PyTuple_New(2);
1168 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1169 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1173 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1177 DataArrayDoubleTuple *aa;
1178 std::vector<double> bb;
1180 int spaceDim=self->getSpaceDimension();
1181 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1182 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1184 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1185 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1188 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1192 std::vector<int> multiVal;
1193 std::pair<int, std::pair<int,int> > slic;
1194 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1195 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1199 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1201 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1203 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1205 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1209 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1211 DataArrayInt *v0=0,*v1=0;
1212 self->findCommonCells(compType,startCellId,v0,v1);
1213 PyObject *res = PyList_New(2);
1214 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1215 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1220 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1223 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1224 if (!SWIG_IsOK(res1))
1227 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1228 self->renumberNodesInConn(tmp);
1232 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1234 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1235 da2->checkAllocated();
1236 self->renumberNodesInConn(da2->getConstPointer());
1240 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1243 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1244 PyObject *ret=PyTuple_New(2);
1245 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1246 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1250 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1252 DataArrayInt *ret=0;
1254 int szArr,sw,iTypppArr;
1255 std::vector<int> stdvecTyyppArr;
1256 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1257 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1261 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1265 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1266 PyObject *res = PyList_New(3);
1267 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1268 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1269 PyList_SetItem(res,2,SWIG_From_int(ret2));
1273 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1277 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1278 PyObject *res = PyList_New(3);
1279 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1280 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1281 PyList_SetItem(res,2,SWIG_From_int(ret2));
1285 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1288 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1289 if (!SWIG_IsOK(res1))
1292 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1293 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1297 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1299 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1300 da2->checkAllocated();
1301 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1305 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1309 std::vector<int> multiVal;
1310 std::pair<int, std::pair<int,int> > slic;
1311 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1312 int nbc=self->getNumberOfCells();
1313 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1320 std::ostringstream oss;
1321 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1322 throw INTERP_KERNEL::Exception(oss.str().c_str());
1325 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1330 int tmp=nbc+singleVal;
1331 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1335 std::ostringstream oss;
1336 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1337 throw INTERP_KERNEL::Exception(oss.str().c_str());
1343 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1347 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1352 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1353 daIntTyypp->checkAllocated();
1354 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1357 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1361 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1364 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1365 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1366 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1367 for(int i=0;i<sz;i++)
1368 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1371 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1374 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1376 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1377 std::vector<double> val3;
1378 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1379 "Rotate2DAlg",2,true,nbNodes);
1381 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1382 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1385 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1388 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1389 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1390 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1391 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1392 for(int i=0;i<sz;i++)
1393 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1396 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1399 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1401 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1402 std::vector<double> val3;
1403 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1404 "Rotate3DAlg",3,true,nbNodes);
1406 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1407 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1408 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1413 //== MEDCouplingPointSet End
1415 class MEDCouplingUMeshCell
1418 INTERP_KERNEL::NormalizedCellType getType() const;
1421 std::string __str__() const throw(INTERP_KERNEL::Exception)
1423 return self->repr();
1426 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1429 const int *r=self->getAllConn(ret2);
1430 PyObject *ret=PyTuple_New(ret2);
1431 for(int i=0;i<ret2;i++)
1432 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1438 class MEDCouplingUMeshCellIterator
1445 MEDCouplingUMeshCell *ret=self->nextt();
1447 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1450 PyErr_SetString(PyExc_StopIteration,"No more data.");
1457 class MEDCouplingUMeshCellByTypeIterator
1460 ~MEDCouplingUMeshCellByTypeIterator();
1465 MEDCouplingUMeshCellEntry *ret=self->nextt();
1467 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1470 PyErr_SetString(PyExc_StopIteration,"No more data.");
1477 class MEDCouplingUMeshCellByTypeEntry
1480 ~MEDCouplingUMeshCellByTypeEntry();
1483 MEDCouplingUMeshCellByTypeIterator *__iter__()
1485 return self->iterator();
1490 class MEDCouplingUMeshCellEntry
1493 INTERP_KERNEL::NormalizedCellType getType() const;
1494 int getNumberOfElems() const;
1497 MEDCouplingUMeshCellIterator *__iter__()
1499 return self->iterator();
1504 //== MEDCouplingUMesh
1506 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1509 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1510 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1511 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1512 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1513 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1514 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1515 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1516 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1517 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1518 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1519 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1520 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1521 void computeTypes() throw(INTERP_KERNEL::Exception);
1522 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1523 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1525 DataArrayInt *conformize2D(double eps) throw(INTERP_KERNEL::Exception);
1526 DataArrayInt *colinearize2D(double eps) throw(INTERP_KERNEL::Exception);
1527 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1528 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1529 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1530 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1531 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1532 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1533 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1534 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1535 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1536 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1537 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1538 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1539 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1540 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1541 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1542 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1543 bool isFullyQuadratic() const throw(INTERP_KERNEL::Exception);
1544 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1545 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1546 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1547 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1548 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1549 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1550 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1551 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1552 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1553 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1554 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1555 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1556 DataArrayDouble *computePlaneEquationOf3DFaces() const throw(INTERP_KERNEL::Exception);
1557 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1558 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1559 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1560 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1561 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1562 DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1563 DataArrayInt *buildUnionOf2DMesh() const throw(INTERP_KERNEL::Exception);
1564 DataArrayInt *buildUnionOf3DMesh() const throw(INTERP_KERNEL::Exception);
1565 DataArrayDouble *getBoundingBoxForBBTreeFast() const throw(INTERP_KERNEL::Exception);
1566 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1567 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1568 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);
1569 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1570 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1571 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1572 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1573 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1575 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1577 return MEDCouplingUMesh::New();
1580 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1582 return MEDCouplingUMesh::New(meshName,meshDim);
1585 std::string __str__() const throw(INTERP_KERNEL::Exception)
1587 return self->simpleRepr();
1590 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1592 std::ostringstream oss;
1593 self->reprQuickOverview(oss);
1597 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1599 return self->cellIterator();
1602 PyObject *getAllGeoTypesSorted() const throw(INTERP_KERNEL::Exception)
1604 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
1605 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1606 PyObject *res=PyList_New(result.size());
1607 for(int i=0;iL!=result.end(); i++, iL++)
1608 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1612 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1616 std::vector<int> multiVal;
1617 std::pair<int, std::pair<int,int> > slic;
1618 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1619 int nbc=self->getNumberOfCells();
1620 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1627 std::ostringstream oss;
1628 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1629 throw INTERP_KERNEL::Exception(oss.str().c_str());
1633 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1640 int tmp=nbc+singleVal;
1641 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1646 std::ostringstream oss;
1647 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1648 throw INTERP_KERNEL::Exception(oss.str().c_str());
1654 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1660 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1661 daIntTyypp->checkAllocated();
1662 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1666 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1670 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1674 std::vector<int> multiVal;
1675 std::pair<int, std::pair<int,int> > slic;
1676 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1677 int nbc=self->getNumberOfCells();
1678 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1685 std::ostringstream oss;
1686 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1687 throw INTERP_KERNEL::Exception(oss.str().c_str());
1691 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1698 int tmp=nbc+singleVal;
1699 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1704 std::ostringstream oss;
1705 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1706 throw INTERP_KERNEL::Exception(oss.str().c_str());
1712 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1717 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1723 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1724 daIntTyypp->checkAllocated();
1725 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1729 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1733 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1735 int szArr,sw,iTypppArr;
1736 std::vector<int> stdvecTyyppArr;
1737 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1740 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1741 throw INTERP_KERNEL::Exception(oss.str().c_str());
1743 self->insertNextCell(type,size,tmp);
1746 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1748 int szArr,sw,iTypppArr;
1749 std::vector<int> stdvecTyyppArr;
1750 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1751 self->insertNextCell(type,szArr,tmp);
1754 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1756 DataArrayInt *ret=self->getNodalConnectivity();
1761 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1763 DataArrayInt *ret=self->getNodalConnectivityIndex();
1769 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1771 int szArr,sw,iTypppArr;
1772 std::vector<int> stdvecTyyppArr;
1773 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1774 int nbOfDepthPeelingPerformed=0;
1775 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1776 PyObject *res=PyTuple_New(2);
1777 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1778 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1782 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1784 DataArrayInt *v0=0,*v1=0;
1785 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1786 PyObject *res = PyList_New(2);
1787 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1788 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1792 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1796 DataArrayDoubleTuple *aa;
1797 std::vector<double> bb;
1799 int nbOfCompo=self->getSpaceDimension();
1800 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1803 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1804 PyObject *ret=PyTuple_New(2);
1805 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1806 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1810 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1812 DataArrayInt *ret1=0;
1813 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1814 PyObject *ret=PyTuple_New(2);
1815 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1816 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1820 PyObject *tetrahedrize(int policy) throw(INTERP_KERNEL::Exception)
1823 DataArrayInt *ret1(0);
1824 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
1825 PyObject *ret=PyTuple_New(3);
1826 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
1827 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1828 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
1832 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1834 std::vector<int> cells;
1835 self->checkButterflyCells(cells,eps);
1836 DataArrayInt *ret=DataArrayInt::New();
1837 ret->alloc((int)cells.size(),1);
1838 std::copy(cells.begin(),cells.end(),ret->getPointer());
1839 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1842 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1844 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1846 PyObject *ret = PyList_New(sz);
1847 for(int i=0;i<sz;i++)
1848 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1852 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1854 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1855 int sz=retCpp.size();
1856 PyObject *ret=PyList_New(sz);
1857 for(int i=0;i<sz;i++)
1858 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1862 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1865 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1866 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1867 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1870 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1873 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1874 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1878 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1881 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1882 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1886 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1888 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1889 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1890 PyObject *ret=PyTuple_New(3);
1891 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1892 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1893 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1897 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1899 DataArrayInt *tmp0=0,*tmp1=0;
1900 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1901 PyObject *ret=PyTuple_New(2);
1902 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1903 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1907 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1911 std::vector<int> multiVal;
1912 std::pair<int, std::pair<int,int> > slic;
1913 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1914 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1918 return self->duplicateNodes(&singleVal,&singleVal+1);
1920 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
1922 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
1924 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1928 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
1932 std::vector<int> multiVal;
1933 std::pair<int, std::pair<int,int> > slic;
1934 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1935 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1939 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
1941 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
1943 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
1945 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1949 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
1952 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1953 DataArrayInt *tmp0,*tmp1=0;
1954 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
1955 PyObject *ret=PyTuple_New(2);
1956 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1957 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1961 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const throw(INTERP_KERNEL::Exception)
1963 DataArrayInt *ret0=0,*ret1=0;
1964 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
1965 PyObject *ret=PyTuple_New(2);
1966 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1967 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1971 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1973 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1974 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1975 DataArrayInt *ret1=0,*ret2=0;
1976 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
1977 PyObject *ret=PyTuple_New(3);
1978 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1979 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1980 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1984 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1986 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1987 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1988 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
1989 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1992 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
1995 std::vector<const MEDCouplingUMesh *> meshes;
1996 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1997 std::vector<DataArrayInt *> corr;
1998 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2000 PyObject *ret1=PyList_New(sz);
2001 for(int i=0;i<sz;i++)
2002 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2003 PyObject *ret=PyList_New(2);
2004 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2005 PyList_SetItem(ret,1,ret1);
2009 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2011 std::vector<MEDCouplingUMesh *> meshes;
2012 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2013 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2016 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
2018 std::vector<MEDCouplingUMesh *> meshes;
2019 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2020 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2023 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
2027 std::vector<int> multiVal;
2028 std::pair<int, std::pair<int,int> > slic;
2029 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2031 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2032 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2036 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2038 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2040 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2042 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2046 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2048 DataArrayInt *arrOut=0,*arrIndexOut=0;
2051 std::vector<int> multiVal;
2052 std::pair<int, std::pair<int,int> > slic;
2053 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2055 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2056 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2061 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2066 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2071 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2075 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2077 PyObject *ret=PyTuple_New(2);
2078 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2079 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2083 static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2085 DataArrayInt *arrOut=0,*arrIndexOut=0;
2086 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2087 PyObject *ret=PyTuple_New(2);
2088 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2089 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2093 static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2095 if(!PySlice_Check(slic))
2096 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !");
2097 Py_ssize_t strt=2,stp=2,step=2;
2098 PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
2100 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !");
2101 arrIndxIn->checkAllocated();
2102 if(arrIndxIn->getNumberOfComponents()!=1)
2103 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !");
2104 GetIndicesOfSlice(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !");
2105 DataArrayInt *arrOut=0,*arrIndexOut=0;
2106 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2107 PyObject *ret=PyTuple_New(2);
2108 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2109 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2113 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2114 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2115 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2117 DataArrayInt *arrOut=0,*arrIndexOut=0;
2120 std::vector<int> multiVal;
2121 std::pair<int, std::pair<int,int> > slic;
2122 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2124 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2125 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2130 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2135 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2140 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2144 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2146 PyObject *ret=PyTuple_New(2);
2147 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2148 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2152 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2153 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2157 std::vector<int> multiVal;
2158 std::pair<int, std::pair<int,int> > slic;
2159 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2161 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2162 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2167 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2172 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2177 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2181 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2185 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2189 DataArrayDoubleTuple *aa;
2190 std::vector<double> bb;
2192 int spaceDim=self->getSpaceDimension();
2193 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2194 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2196 std::vector<int> cells;
2197 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2198 DataArrayInt *ret=DataArrayInt::New();
2199 ret->alloc((int)cells.size(),1);
2200 std::copy(cells.begin(),cells.end(),ret->getPointer());
2201 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2204 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2208 DataArrayDoubleTuple *aa;
2209 std::vector<double> bb;
2211 int spaceDim=self->getSpaceDimension();
2212 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2213 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2214 self->orientCorrectly2DCells(v,polyOnly);
2217 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2219 std::vector<int> cells;
2220 self->arePolyhedronsNotCorrectlyOriented(cells);
2221 DataArrayInt *ret=DataArrayInt::New();
2222 ret->alloc((int)cells.size(),1);
2223 std::copy(cells.begin(),cells.end(),ret->getPointer());
2224 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2227 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2231 self->getFastAveragePlaneOfThis(vec,pos);
2233 std::copy(vec,vec+3,vals);
2234 std::copy(pos,pos+3,vals+3);
2235 return convertDblArrToPyListOfTuple(vals,3,2);
2238 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2240 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2241 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2242 return MEDCouplingUMesh::MergeUMeshes(tmp);
2245 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2248 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2249 PyObject *ret=PyTuple_New(2);
2250 PyObject *ret0Py=ret0?Py_True:Py_False;
2252 PyTuple_SetItem(ret,0,ret0Py);
2253 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2257 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2260 bool ret0=self->areCellsIncludedIn2(other,ret1);
2261 PyObject *ret=PyTuple_New(2);
2262 PyObject *ret0Py=ret0?Py_True:Py_False;
2264 PyTuple_SetItem(ret,0,ret0Py);
2265 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2269 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2271 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2272 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2273 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2274 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2275 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2276 PyObject *ret=PyTuple_New(5);
2277 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2278 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2279 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2280 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2281 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2285 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2287 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2288 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2289 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2290 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2291 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2292 PyObject *ret=PyTuple_New(5);
2293 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2294 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2295 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2296 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2297 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2301 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2303 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2304 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2305 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2306 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2307 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2308 PyObject *ret=PyTuple_New(5);
2309 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2310 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2311 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2312 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2313 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2317 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2319 DataArrayInt *neighbors=0,*neighborsIdx=0;
2320 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2321 PyObject *ret=PyTuple_New(2);
2322 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2323 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2327 PyObject *computeNeighborsOfNodes() const throw(INTERP_KERNEL::Exception)
2329 DataArrayInt *neighbors=0,*neighborsIdx=0;
2330 self->computeNeighborsOfNodes(neighbors,neighborsIdx);
2331 PyObject *ret=PyTuple_New(2);
2332 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2333 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2337 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2339 DataArrayInt *neighbors=0,*neighborsIdx=0;
2340 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2341 PyObject *ret=PyTuple_New(2);
2342 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2343 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2347 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2349 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2350 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2351 DataArrayInt *d2,*d3,*d4,*dd5;
2352 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2353 PyObject *ret=PyTuple_New(7);
2354 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2355 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2356 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2357 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2358 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2359 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2360 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2364 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2367 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2368 da->checkAllocated();
2369 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2372 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2375 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2376 da->checkAllocated();
2377 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2380 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2383 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2384 da->checkAllocated();
2385 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2388 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2391 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2392 da->checkAllocated();
2393 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2394 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2395 PyObject *res = PyList_New(result.size());
2396 for (int i=0;iL!=result.end(); i++, iL++)
2397 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2401 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2404 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2405 da->checkAllocated();
2406 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2407 ret->setName(da->getName().c_str());
2411 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2413 DataArrayInt *cellNb1=0,*cellNb2=0;
2414 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2415 PyObject *ret=PyTuple_New(3);
2416 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2417 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2418 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2422 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2424 int spaceDim=self->getSpaceDimension();
2426 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2428 DataArrayDouble *a,*a2;
2429 DataArrayDoubleTuple *aa,*aa2;
2430 std::vector<double> bb,bb2;
2432 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2433 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2434 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2435 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2437 DataArrayInt *cellIds=0;
2438 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2439 PyObject *ret=PyTuple_New(2);
2440 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2441 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2445 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2447 int spaceDim=self->getSpaceDimension();
2449 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2451 DataArrayDouble *a,*a2;
2452 DataArrayDoubleTuple *aa,*aa2;
2453 std::vector<double> bb,bb2;
2455 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2456 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2457 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2458 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2460 DataArrayInt *cellIds=0;
2461 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2462 PyObject *ret=PyTuple_New(2);
2463 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2464 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2468 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2470 int spaceDim=self->getSpaceDimension();
2472 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2474 DataArrayDouble *a,*a2;
2475 DataArrayDoubleTuple *aa,*aa2;
2476 std::vector<double> bb,bb2;
2478 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2479 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2480 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2481 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2482 return self->getCellIdsCrossingPlane(orig,vect,eps);
2485 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2489 std::vector<int> pos2;
2490 DataArrayInt *pos3=0;
2491 DataArrayIntTuple *pos4=0;
2492 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2497 self->convertToPolyTypes(&pos1,&pos1+1);
2504 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2509 self->convertToPolyTypes(pos3->begin(),pos3->end());
2513 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2517 void convertAllToPoly();
2518 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2519 bool unPolyze() throw(INTERP_KERNEL::Exception);
2520 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2521 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2522 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2525 //== MEDCouplingUMesh End
2527 //== MEDCouplingExtrudedMesh
2529 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2532 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2533 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2535 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2537 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2540 std::string __str__() const throw(INTERP_KERNEL::Exception)
2542 return self->simpleRepr();
2545 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2547 std::ostringstream oss;
2548 self->reprQuickOverview(oss);
2552 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2554 MEDCouplingUMesh *ret=self->getMesh2D();
2557 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2559 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2561 MEDCouplingUMesh *ret=self->getMesh1D();
2564 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2566 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2568 DataArrayInt *ret=self->getMesh3DIds();
2571 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2576 //== MEDCouplingExtrudedMesh End
2578 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2581 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2582 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2583 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2584 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2585 virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2586 virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
2589 virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2591 int szArr,sw,iTypppArr;
2592 std::vector<int> stdvecTyyppArr;
2593 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2594 self->insertNextCell(tmp,tmp+szArr);
2597 virtual DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2599 DataArrayInt *ret=self->getNodalConnectivity();
2600 if(ret) ret->incrRef();
2604 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2606 std::vector< const MEDCoupling1GTUMesh *> parts;
2607 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
2608 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
2613 //== MEDCoupling1SGTUMesh
2615 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2618 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2619 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2620 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2621 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2622 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2623 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2624 MEDCoupling1GTUMesh *computeDualMesh() const throw(INTERP_KERNEL::Exception);
2625 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const throw(INTERP_KERNEL::Exception);
2626 DataArrayInt *sortHexa8EachOther() throw(INTERP_KERNEL::Exception);
2629 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2631 return MEDCoupling1SGTUMesh::New(name,type);
2634 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2636 return MEDCoupling1SGTUMesh::New(m);
2639 std::string __str__() const throw(INTERP_KERNEL::Exception)
2641 return self->simpleRepr();
2644 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2646 std::ostringstream oss;
2647 self->reprQuickOverview(oss);
2651 PyObject *structurizeMe(double eps=1e-12) const throw(INTERP_KERNEL::Exception)
2653 DataArrayInt *cellPerm(0),*nodePerm(0);
2654 MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps));
2655 PyObject *ret(PyTuple_New(3));
2656 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 ));
2657 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2658 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2662 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2664 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2665 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2666 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2669 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2671 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2672 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2673 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2678 //== MEDCoupling1SGTUMesh End
2680 //== MEDCoupling1DGTUMesh
2682 class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2685 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2686 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2687 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
2688 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2689 bool isPacked() const throw(INTERP_KERNEL::Exception);
2692 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2694 return MEDCoupling1DGTUMesh::New(name,type);
2697 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2699 return MEDCoupling1DGTUMesh::New(m);
2702 std::string __str__() const throw(INTERP_KERNEL::Exception)
2704 return self->simpleRepr();
2707 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2709 std::ostringstream oss;
2710 self->reprQuickOverview(oss);
2714 DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
2716 DataArrayInt *ret=self->getNodalConnectivityIndex();
2717 if(ret) ret->incrRef();
2721 PyObject *retrievePackedNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2723 DataArrayInt *ret1=0,*ret2=0;
2724 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
2725 PyObject *ret0Py=ret0?Py_True:Py_False;
2727 PyObject *ret=PyTuple_New(3);
2728 PyTuple_SetItem(ret,0,ret0Py);
2729 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2730 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2734 PyObject *copyWithNodalConnectivityPacked() const throw(INTERP_KERNEL::Exception)
2737 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
2738 PyObject *ret=PyTuple_New(2);
2739 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
2740 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
2741 PyTuple_SetItem(ret,1,ret1Py);
2745 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2747 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2748 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2749 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
2752 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2754 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2755 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2756 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
2759 static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt) throw(INTERP_KERNEL::Exception)
2761 std::vector<const ParaMEDMEM::DataArrayInt *> tmp;
2762 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2763 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
2768 //== MEDCoupling1DGTUMeshEnd
2770 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2773 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2774 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2775 int getNumberOfCellsOfSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2776 int getSpaceDimensionOnNodeStruct() const throw(INTERP_KERNEL::Exception);
2777 virtual std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2778 std::vector<int> getCellGridStructure() const throw(INTERP_KERNEL::Exception);
2779 MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception);
2780 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
2781 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2782 static int DeduceNumberOfGivenStructure(const std::vector<int>& st) throw(INTERP_KERNEL::Exception);
2783 static std::vector<int> GetSplitVectFromStruct(const std::vector<int>& strct) throw(INTERP_KERNEL::Exception);
2786 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const throw(INTERP_KERNEL::Exception)
2788 int tmpp1=-1,tmpp2=-1;
2789 std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
2790 std::vector< std::pair<int,int> > inp;
2794 for(int i=0;i<tmpp1;i++)
2795 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2800 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
2801 inp.resize(tmpp1/2);
2802 for(int i=0;i<tmpp1/2;i++)
2803 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2806 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
2807 return self->buildStructuredSubPart(inp);
2810 static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) throw(INTERP_KERNEL::Exception)
2812 std::vector< std::pair<int,int> > inp;
2813 convertPyToVectorPairInt(part,inp);
2815 int szArr,sw,iTypppArr;
2816 std::vector<int> stdvecTyyppArr;
2817 const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
2818 std::vector<int> tmp5(tmp4,tmp4+szArr);
2820 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
2823 static int DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part) throw(INTERP_KERNEL::Exception)
2825 std::vector< std::pair<int,int> > inp;
2826 convertPyToVectorPairInt(part,inp);
2827 return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp);
2830 static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) throw(INTERP_KERNEL::Exception)
2832 int szArr,sw,iTypppArr;
2833 std::vector<int> stdvecTyyppArr;
2834 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2835 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
2838 static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2840 int szArr,sw,iTypppArr;
2841 std::vector<int> stdvecTyyppArr;
2842 const int *tmp(convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr));
2843 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
2846 static std::vector<int> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat) throw(INTERP_KERNEL::Exception)
2848 std::vector< std::pair<int,int> > inp;
2849 convertPyToVectorPairInt(partCompactFormat,inp);
2850 return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp);
2853 static PyObject *IsPartStructured(PyObject *li, PyObject *st) throw(INTERP_KERNEL::Exception)
2855 int szArr,sw,iTypppArr;
2856 std::vector<int> stdvecTyyppArr;
2857 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2858 int szArr2,sw2,iTypppArr2;
2859 std::vector<int> stdvecTyyppArr2;
2860 const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
2861 std::vector<int> tmp3(tmp2,tmp2+szArr2);
2862 std::vector< std::pair<int,int> > partCompactFormat;
2863 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
2864 PyObject *ret=PyTuple_New(2);
2865 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
2866 PyTuple_SetItem(ret,0,ret0Py);
2867 PyObject *ret1Py=PyList_New(partCompactFormat.size());
2868 for(std::size_t i=0;i<partCompactFormat.size();i++)
2870 PyObject *tmp4=PyTuple_New(2);
2871 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
2872 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
2873 PyList_SetItem(ret1Py,i,tmp4);
2875 PyTuple_SetItem(ret,1,ret1Py);
2881 //== MEDCouplingCMesh
2883 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2886 static MEDCouplingCMesh *New() throw(INTERP_KERNEL::Exception);
2887 static MEDCouplingCMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
2888 MEDCouplingCMesh *clone(bool recDeepCpy) const;
2889 void setCoords(const DataArrayDouble *coordsX,
2890 const DataArrayDouble *coordsY=0,
2891 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
2892 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
2894 MEDCouplingCMesh() throw(INTERP_KERNEL::Exception)
2896 return MEDCouplingCMesh::New();
2898 MEDCouplingCMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
2900 return MEDCouplingCMesh::New(meshName);
2902 std::string __str__() const throw(INTERP_KERNEL::Exception)
2904 return self->simpleRepr();
2906 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2908 std::ostringstream oss;
2909 self->reprQuickOverview(oss);
2912 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
2914 DataArrayDouble *ret=self->getCoordsAt(i);
2922 //== MEDCouplingCMesh End
2924 //== MEDCouplingCurveLinearMesh
2926 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2929 static MEDCouplingCurveLinearMesh *New() throw(INTERP_KERNEL::Exception);
2930 static MEDCouplingCurveLinearMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
2931 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
2932 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
2934 MEDCouplingCurveLinearMesh() throw(INTERP_KERNEL::Exception)
2936 return MEDCouplingCurveLinearMesh::New();
2938 MEDCouplingCurveLinearMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
2940 return MEDCouplingCurveLinearMesh::New(meshName);
2942 std::string __str__() const throw(INTERP_KERNEL::Exception)
2944 return self->simpleRepr();
2946 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2948 std::ostringstream oss;
2949 self->reprQuickOverview(oss);
2952 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
2954 DataArrayDouble *ret=self->getCoords();
2959 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
2961 int szArr,sw,iTypppArr;
2962 std::vector<int> stdvecTyyppArr;
2963 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
2964 self->setNodeGridStructure(tmp,tmp+szArr);
2969 //== MEDCouplingCurveLinearMesh End
2971 //== MEDCouplingIMesh
2973 class MEDCouplingIMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2976 static MEDCouplingIMesh *New() throw(INTERP_KERNEL::Exception);
2978 void setSpaceDimension(int spaceDim) throw(INTERP_KERNEL::Exception);
2979 std::vector<int> getNodeStruct() const throw(INTERP_KERNEL::Exception);
2980 std::vector<double> getOrigin() const throw(INTERP_KERNEL::Exception);
2981 std::vector<double> getDXYZ() const throw(INTERP_KERNEL::Exception);
2982 void setAxisUnit(const std::string& unitName) throw(INTERP_KERNEL::Exception);
2983 std::string getAxisUnit() const throw(INTERP_KERNEL::Exception);
2984 double getMeasureOfAnyCell() const throw(INTERP_KERNEL::Exception);
2985 MEDCouplingCMesh *convertToCartesian() const throw(INTERP_KERNEL::Exception);
2986 void refineWithFactor(int factor) throw(INTERP_KERNEL::Exception);
2991 return MEDCouplingIMesh::New();
2993 static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
2995 static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
2996 static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
2997 const int *nodeStrctPtr(0);
2998 const double *originPtr(0),*dxyzPtr(0);
3000 std::vector<int> bb0;
3001 nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
3004 std::vector<double> bb,bb2;
3006 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
3007 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
3009 return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
3012 MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3014 return ParaMEDMEM_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
3017 void setNodeStruct(PyObject *nodeStrct) throw(INTERP_KERNEL::Exception)
3020 std::vector<int> bb0;
3021 const int *nodeStrctPtr(convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0));
3022 self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
3025 void setOrigin(PyObject *origin) throw(INTERP_KERNEL::Exception)
3027 static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3030 DataArrayDoubleTuple *aa;
3031 std::vector<double> bb;
3033 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
3034 self->setOrigin(originPtr,originPtr+nbTuples);
3037 void setDXYZ(PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3039 static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3042 DataArrayDoubleTuple *aa;
3043 std::vector<double> bb;
3045 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
3046 self->setDXYZ(originPtr,originPtr+nbTuples);
3049 static void CondenseFineToCoarse(DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse) throw(INTERP_KERNEL::Exception)
3051 std::vector< std::pair<int,int> > inp;
3052 convertPyToVectorPairInt(fineLocInCoarse,inp);
3053 MEDCouplingIMesh::CondenseFineToCoarse(coarseDA,coarseSt,fineDA,inp);
3056 std::string __str__() const throw(INTERP_KERNEL::Exception)
3058 return self->simpleRepr();
3060 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3062 std::ostringstream oss;
3063 self->reprQuickOverview(oss);
3069 //== MEDCouplingIMesh End
3073 namespace ParaMEDMEM
3075 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
3078 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
3079 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
3080 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3081 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3082 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
3083 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
3084 void setName(const char *name) throw(INTERP_KERNEL::Exception);
3085 std::string getDescription() const throw(INTERP_KERNEL::Exception);
3086 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
3087 std::string getName() const throw(INTERP_KERNEL::Exception);
3088 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
3089 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
3090 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
3091 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
3092 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
3093 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
3094 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
3095 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3096 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
3097 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
3098 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
3099 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
3100 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
3101 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
3102 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
3103 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3105 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
3107 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3110 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3113 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
3115 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3118 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3121 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
3123 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
3124 return convertIntArrToPyList3(ret);
3127 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
3130 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
3131 PyObject *ret=PyTuple_New(2);
3132 PyObject *ret0Py=ret0?Py_True:Py_False;
3134 PyTuple_SetItem(ret,0,ret0Py);
3135 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3139 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
3141 DataArrayInt *ret1=0;
3142 MEDCouplingMesh *ret0=0;
3144 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3145 if (!SWIG_IsOK(res1))
3148 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3149 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3153 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3155 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3156 da2->checkAllocated();
3157 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3159 PyObject *res = PyList_New(2);
3160 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3161 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3165 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
3167 DataArrayInt *ret1=0;
3169 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3170 PyObject *res=PyTuple_New(2);
3171 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3173 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3176 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3177 PyTuple_SetItem(res,1,res1);
3182 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3185 int v0; std::vector<int> v1;
3186 const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
3187 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3190 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3191 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3194 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3195 if (!SWIG_IsOK(res1))
3198 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3199 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3203 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3205 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3206 da2->checkAllocated();
3207 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3211 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3213 std::vector<int> tmp;
3214 self->getCellIdsHavingGaussLocalization(locId,tmp);
3215 DataArrayInt *ret=DataArrayInt::New();
3216 ret->alloc((int)tmp.size(),1);
3217 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3218 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3221 int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
3223 std::vector<int> inp0;
3224 convertPyToNewIntArr4(code,1,3,inp0);
3225 std::vector<const DataArrayInt *> inp1;
3226 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(idsPerType,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",inp1);
3227 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3232 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3235 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3236 static MEDCouplingFieldTemplate *New(TypeOfField type);
3237 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3238 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3241 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3243 return MEDCouplingFieldTemplate::New(f);
3246 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3248 return MEDCouplingFieldTemplate::New(type);
3251 std::string __str__() const throw(INTERP_KERNEL::Exception)
3253 return self->simpleRepr();
3256 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3258 std::ostringstream oss;
3259 self->reprQuickOverview(oss);
3265 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3268 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3269 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3270 void setTimeUnit(const std::string& unit);
3271 std::string getTimeUnit() const;
3272 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3273 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3274 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3275 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3276 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3277 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
3278 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3279 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3280 MEDCouplingFieldDouble *deepCpy() const;
3281 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3282 MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
3283 MEDCouplingFieldDouble *cellToNodeDiscretization() const throw(INTERP_KERNEL::Exception);
3284 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3285 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3286 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3287 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3288 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3289 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3290 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3291 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3292 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3293 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3294 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3295 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3296 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3297 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3298 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3299 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3300 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3301 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3302 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3303 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3304 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3305 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3306 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3307 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3308 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3309 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3310 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3311 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3312 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3313 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3314 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3315 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3316 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3317 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3318 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3319 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3320 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3321 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3322 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3323 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3324 void fillFromAnalytic(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3325 void fillFromAnalytic2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3326 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3327 void applyFunc(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3328 void applyFunc2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3329 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3330 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3331 void applyFunc(const std::string& func) throw(INTERP_KERNEL::Exception);
3332 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
3333 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
3334 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3335 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3336 double getMinValue() const throw(INTERP_KERNEL::Exception);
3337 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3338 double norm2() const throw(INTERP_KERNEL::Exception);
3339 double normMax() const throw(INTERP_KERNEL::Exception);
3340 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3341 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3342 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3343 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3344 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3345 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3346 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3347 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3348 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3349 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3350 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3351 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3352 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3353 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3354 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3355 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3356 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3357 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3358 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3359 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3360 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3361 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3363 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3365 return MEDCouplingFieldDouble::New(type,td);
3368 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3370 return MEDCouplingFieldDouble::New(ft,td);
3373 std::string __str__() const throw(INTERP_KERNEL::Exception)
3375 return self->simpleRepr();
3378 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3380 std::ostringstream oss;
3381 self->reprQuickOverview(oss);
3385 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3387 DataArrayDouble *ret=self->getArray();
3393 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3395 std::vector<DataArrayDouble *> arrs=self->getArrays();
3396 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3400 PyObject *ret=PyTuple_New(sz);
3401 for(int i=0;i<sz;i++)
3404 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3406 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3411 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3413 std::vector<const DataArrayDouble *> tmp;
3414 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3416 std::vector<DataArrayDouble *> arrs(sz);
3417 for(int i=0;i<sz;i++)
3418 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3419 self->setArrays(arrs);
3422 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3424 DataArrayDouble *ret=self->getEndArray();
3430 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3434 DataArrayDoubleTuple *aa;
3435 std::vector<double> bb;
3437 const MEDCouplingMesh *mesh=self->getMesh();
3439 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3440 int spaceDim=mesh->getSpaceDimension();
3441 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3442 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3444 int sz=self->getNumberOfComponents();
3445 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3446 self->getValueOn(spaceLoc,res);
3447 return convertDblArrToPyList(res,sz);
3450 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3452 int sz=self->getNumberOfComponents();
3453 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3454 self->getValueOnPos(i,j,k,res);
3455 return convertDblArrToPyList(res,sz);
3458 DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
3460 const MEDCouplingMesh *mesh(self->getMesh());
3462 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3465 double v0; ParaMEDMEM::DataArrayDouble *v1(0); ParaMEDMEM::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
3466 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
3467 mesh->getSpaceDimension(),true,nbPts);
3468 return self->getValueOnMulti(inp,nbPts);
3471 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3475 DataArrayDoubleTuple *aa;
3476 std::vector<double> bb;
3478 const MEDCouplingMesh *mesh=self->getMesh();
3480 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3481 int spaceDim=mesh->getSpaceDimension();
3482 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3483 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3486 int sz=self->getNumberOfComponents();
3487 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3488 self->getValueOn(spaceLoc,time,res);
3489 return convertDblArrToPyList(res,sz);
3492 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3494 if(self->getArray()!=0)
3495 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3498 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3499 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3500 self->setArray(arr);
3504 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3507 double tmp0=self->getTime(tmp1,tmp2);
3508 PyObject *res = PyList_New(3);
3509 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3510 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3511 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3515 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3518 double tmp0=self->getStartTime(tmp1,tmp2);
3519 PyObject *res = PyList_New(3);
3520 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3521 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3522 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3526 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3529 double tmp0=self->getEndTime(tmp1,tmp2);
3530 PyObject *res = PyList_New(3);
3531 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3532 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3533 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3536 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3538 int sz=self->getNumberOfComponents();
3539 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3540 self->accumulate(tmp);
3541 return convertDblArrToPyList(tmp,sz);
3543 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3545 int sz=self->getNumberOfComponents();
3546 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3547 self->integral(isWAbs,tmp);
3548 return convertDblArrToPyList(tmp,sz);
3550 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3552 int sz=self->getNumberOfComponents();
3553 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3554 self->getWeightedAverageValue(tmp,isWAbs);
3555 return convertDblArrToPyList(tmp,sz);
3557 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3559 int sz=self->getNumberOfComponents();
3560 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3562 return convertDblArrToPyList(tmp,sz);
3564 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3566 int sz=self->getNumberOfComponents();
3567 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3569 return convertDblArrToPyList(tmp,sz);
3571 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3573 int szArr,sw,iTypppArr;
3574 std::vector<int> stdvecTyyppArr;
3575 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3576 self->renumberCells(tmp,check);
3579 void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3581 int szArr,sw,iTypppArr;
3582 std::vector<int> stdvecTyyppArr;
3583 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3584 self->renumberCellsWithoutMesh(tmp,check);
3587 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3589 int szArr,sw,iTypppArr;
3590 std::vector<int> stdvecTyyppArr;
3591 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3592 self->renumberNodes(tmp,eps);
3595 void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3597 int szArr,sw,iTypppArr;
3598 std::vector<int> stdvecTyyppArr;
3599 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3600 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
3603 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3607 std::vector<int> multiVal;
3608 std::pair<int, std::pair<int,int> > slic;
3609 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3610 const MEDCouplingMesh *mesh=self->getMesh();
3612 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3613 int nbc=mesh->getNumberOfCells();
3614 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3621 std::ostringstream oss;
3622 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3623 throw INTERP_KERNEL::Exception(oss.str().c_str());
3626 return self->buildSubPart(&singleVal,&singleVal+1);
3631 int tmp=nbc+singleVal;
3632 return self->buildSubPart(&tmp,&tmp+1);
3636 std::ostringstream oss;
3637 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3638 throw INTERP_KERNEL::Exception(oss.str().c_str());
3644 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3648 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3653 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3654 daIntTyypp->checkAllocated();
3655 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3658 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3662 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3664 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";
3665 if(PyTuple_Check(li))
3667 Py_ssize_t sz=PyTuple_Size(li);
3669 throw INTERP_KERNEL::Exception(msg);
3670 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3673 std::vector<int> multiVal;
3674 std::pair<int, std::pair<int,int> > slic;
3675 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3676 if(!self->getArray())
3677 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3679 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3680 catch(INTERP_KERNEL::Exception& e)
3681 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3682 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3683 DataArrayDouble *ret0Arr=ret0->getArray();
3685 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3690 std::vector<int> v2(1,singleVal);
3691 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3692 ret0->setArray(aarr);
3697 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3698 ret0->setArray(aarr);
3703 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3704 std::vector<int> v2(nbOfComp);
3705 for(int i=0;i<nbOfComp;i++)
3706 v2[i]=slic.first+i*slic.second.second;
3707 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3708 ret0->setArray(aarr);
3712 throw INTERP_KERNEL::Exception(msg);
3717 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3720 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3723 double r1=self->getMaxValue2(tmp);
3724 PyObject *ret=PyTuple_New(2);
3725 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3726 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3730 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3733 double r1=self->getMinValue2(tmp);
3734 PyObject *ret=PyTuple_New(2);
3735 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3736 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3740 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3742 std::vector<int> tmp;
3743 convertPyToNewIntArr3(li,tmp);
3744 return self->keepSelectedComponents(tmp);
3747 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3749 std::vector<int> tmp;
3750 convertPyToNewIntArr3(li,tmp);
3751 self->setSelectedComponents(f,tmp);
3754 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3757 DataArrayDouble *a,*a2;
3758 DataArrayDoubleTuple *aa,*aa2;
3759 std::vector<double> bb,bb2;
3762 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
3763 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
3764 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3765 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3767 return self->extractSlice3D(orig,vect,eps);
3770 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3772 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
3775 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3777 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
3780 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3782 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.";
3783 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
3786 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3788 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3790 return (*self)-(*other);
3792 throw INTERP_KERNEL::Exception(msg);
3797 DataArrayDoubleTuple *aa;
3798 std::vector<double> bb;
3800 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3805 if(!self->getArray())
3806 throw INTERP_KERNEL::Exception(msg2);
3807 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3808 ret->applyLin(1.,-val);
3809 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3810 ret2->setArray(ret);
3815 if(!self->getArray())
3816 throw INTERP_KERNEL::Exception(msg2);
3817 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
3818 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3819 ret2->setArray(ret);
3824 if(!self->getArray())
3825 throw INTERP_KERNEL::Exception(msg2);
3826 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3827 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3828 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3829 ret2->setArray(ret);
3834 if(!self->getArray())
3835 throw INTERP_KERNEL::Exception(msg2);
3836 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3837 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3838 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3839 ret2->setArray(ret);
3843 { throw INTERP_KERNEL::Exception(msg); }
3847 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3849 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
3852 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3854 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
3857 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3859 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
3862 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3864 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.";
3865 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
3868 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3870 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3872 return (*self)/(*other);
3874 throw INTERP_KERNEL::Exception(msg);
3879 DataArrayDoubleTuple *aa;
3880 std::vector<double> bb;
3882 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3888 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
3889 if(!self->getArray())
3890 throw INTERP_KERNEL::Exception(msg2);
3891 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3892 ret->applyLin(1./val,0);
3893 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3894 ret2->setArray(ret);
3899 if(!self->getArray())
3900 throw INTERP_KERNEL::Exception(msg2);
3901 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
3902 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3903 ret2->setArray(ret);
3908 if(!self->getArray())
3909 throw INTERP_KERNEL::Exception(msg2);
3910 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3911 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3912 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3913 ret2->setArray(ret);
3918 if(!self->getArray())
3919 throw INTERP_KERNEL::Exception(msg2);
3920 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3921 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3922 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3923 ret2->setArray(ret);
3927 { throw INTERP_KERNEL::Exception(msg); }
3931 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3933 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
3936 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3938 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.";
3939 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
3942 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3944 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3946 return (*self)^(*other);
3948 throw INTERP_KERNEL::Exception(msg);
3953 DataArrayDoubleTuple *aa;
3954 std::vector<double> bb;
3956 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3961 if(!self->getArray())
3962 throw INTERP_KERNEL::Exception(msg2);
3963 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3965 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3966 ret2->setArray(ret);
3971 if(!self->getArray())
3972 throw INTERP_KERNEL::Exception(msg2);
3973 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
3974 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3975 ret2->setArray(ret);
3980 if(!self->getArray())
3981 throw INTERP_KERNEL::Exception(msg2);
3982 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3983 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3984 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3985 ret2->setArray(ret);
3990 if(!self->getArray())
3991 throw INTERP_KERNEL::Exception(msg2);
3992 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3993 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3994 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3995 ret2->setArray(ret);
3999 { throw INTERP_KERNEL::Exception(msg); }
4003 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
4005 return self->negate();
4008 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4010 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.";
4011 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
4014 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4016 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4020 Py_XINCREF(trueSelf);
4024 throw INTERP_KERNEL::Exception(msg);
4029 DataArrayDoubleTuple *aa;
4030 std::vector<double> bb;
4032 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4037 if(!self->getArray())
4038 throw INTERP_KERNEL::Exception(msg2);
4039 self->getArray()->applyLin(1.,val);
4040 Py_XINCREF(trueSelf);
4045 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4048 Py_XINCREF(trueSelf);
4053 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4054 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4055 ret2->setArray(aaa);
4057 Py_XINCREF(trueSelf);
4062 if(!self->getArray())
4063 throw INTERP_KERNEL::Exception(msg2);
4064 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4065 self->getArray()->addEqual(aaa);
4066 Py_XINCREF(trueSelf);
4070 { throw INTERP_KERNEL::Exception(msg); }
4074 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4076 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.";
4077 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4080 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4082 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4086 Py_XINCREF(trueSelf);
4090 throw INTERP_KERNEL::Exception(msg);
4095 DataArrayDoubleTuple *aa;
4096 std::vector<double> bb;
4098 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4103 if(!self->getArray())
4104 throw INTERP_KERNEL::Exception(msg2);
4105 self->getArray()->applyLin(1.,-val);
4106 Py_XINCREF(trueSelf);
4111 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4114 Py_XINCREF(trueSelf);
4119 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4120 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4121 ret2->setArray(aaa);
4123 Py_XINCREF(trueSelf);
4128 if(!self->getArray())
4129 throw INTERP_KERNEL::Exception(msg2);
4130 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4131 self->getArray()->substractEqual(aaa);
4132 Py_XINCREF(trueSelf);
4136 { throw INTERP_KERNEL::Exception(msg); }
4140 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4142 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.";
4143 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4146 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4148 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4152 Py_XINCREF(trueSelf);
4156 throw INTERP_KERNEL::Exception(msg);
4161 DataArrayDoubleTuple *aa;
4162 std::vector<double> bb;
4164 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4169 if(!self->getArray())
4170 throw INTERP_KERNEL::Exception(msg2);
4171 self->getArray()->applyLin(val,0);
4172 Py_XINCREF(trueSelf);
4177 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4180 Py_XINCREF(trueSelf);
4185 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4186 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4187 ret2->setArray(aaa);
4189 Py_XINCREF(trueSelf);
4194 if(!self->getArray())
4195 throw INTERP_KERNEL::Exception(msg2);
4196 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4197 self->getArray()->multiplyEqual(aaa);
4198 Py_XINCREF(trueSelf);
4202 { throw INTERP_KERNEL::Exception(msg); }
4206 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4208 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.";
4209 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4212 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4214 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4218 Py_XINCREF(trueSelf);
4222 throw INTERP_KERNEL::Exception(msg);
4227 DataArrayDoubleTuple *aa;
4228 std::vector<double> bb;
4230 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4236 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4237 if(!self->getArray())
4238 throw INTERP_KERNEL::Exception(msg2);
4239 self->getArray()->applyLin(1./val,0);
4240 Py_XINCREF(trueSelf);
4245 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4248 Py_XINCREF(trueSelf);
4253 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4254 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4255 ret2->setArray(aaa);
4257 Py_XINCREF(trueSelf);
4262 if(!self->getArray())
4263 throw INTERP_KERNEL::Exception(msg2);
4264 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4265 self->getArray()->divideEqual(aaa);
4266 Py_XINCREF(trueSelf);
4270 { throw INTERP_KERNEL::Exception(msg); }
4274 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4276 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.";
4277 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4280 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4282 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4286 Py_XINCREF(trueSelf);
4290 throw INTERP_KERNEL::Exception(msg);
4295 DataArrayDoubleTuple *aa;
4296 std::vector<double> bb;
4298 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4303 if(!self->getArray())
4304 throw INTERP_KERNEL::Exception(msg2);
4305 self->getArray()->applyPow(val);
4306 Py_XINCREF(trueSelf);
4311 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4314 Py_XINCREF(trueSelf);
4319 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4320 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4321 ret2->setArray(aaa);
4323 Py_XINCREF(trueSelf);
4328 if(!self->getArray())
4329 throw INTERP_KERNEL::Exception(msg2);
4330 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4331 self->getArray()->powEqual(aaa);
4332 Py_XINCREF(trueSelf);
4336 { throw INTERP_KERNEL::Exception(msg); }
4340 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4342 std::vector<const MEDCouplingFieldDouble *> tmp;
4343 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4344 return MEDCouplingFieldDouble::MergeFields(tmp);
4347 static void WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
4349 std::vector<const MEDCouplingFieldDouble *> tmp;
4350 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4351 MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4356 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4359 int getNumberOfFields() const;
4360 MEDCouplingMultiFields *deepCpy() const;
4361 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4362 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4363 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4364 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4365 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4368 std::string __str__() const throw(INTERP_KERNEL::Exception)
4370 return self->simpleRepr();
4372 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4374 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4375 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4377 std::vector<MEDCouplingFieldDouble *> fs(sz);
4378 for(int i=0;i<sz;i++)
4379 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4380 return MEDCouplingMultiFields::New(fs);
4382 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4384 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4385 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4387 std::vector<MEDCouplingFieldDouble *> fs(sz);
4388 for(int i=0;i<sz;i++)
4389 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4390 return MEDCouplingMultiFields::New(fs);
4392 PyObject *getFields() const
4394 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4395 int sz=fields.size();
4396 PyObject *res = PyList_New(sz);
4397 for(int i=0;i<sz;i++)
4401 fields[i]->incrRef();
4402 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4406 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4411 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4413 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4417 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4420 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4422 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4424 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4426 PyObject *res = PyList_New(sz);
4427 for(int i=0;i<sz;i++)
4432 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4436 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4441 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4443 std::vector<int> refs;
4444 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4446 PyObject *res = PyList_New(sz);
4447 for(int i=0;i<sz;i++)
4452 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4456 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4460 PyObject *ret=PyTuple_New(2);
4461 PyTuple_SetItem(ret,0,res);
4462 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4465 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4467 std::vector<DataArrayDouble *> ms=self->getArrays();
4469 PyObject *res = PyList_New(sz);
4470 for(int i=0;i<sz;i++)
4475 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4479 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4484 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4486 std::vector< std::vector<int> > refs;
4487 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4489 PyObject *res = PyList_New(sz);
4490 PyObject *res2 = PyList_New(sz);
4491 for(int i=0;i<sz;i++)
4496 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4500 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4502 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4505 PyObject *ret=PyTuple_New(2);
4506 PyTuple_SetItem(ret,0,res);
4507 PyTuple_SetItem(ret,1,res2);
4513 class MEDCouplingDefinitionTime
4516 MEDCouplingDefinitionTime();
4517 void assign(const MEDCouplingDefinitionTime& other);
4518 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4519 double getTimeResolution() const;
4520 std::vector<double> getHotSpotsTime() const;
4523 std::string __str__() const throw(INTERP_KERNEL::Exception)
4525 std::ostringstream oss;
4526 self->appendRepr(oss);
4530 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4532 int meshId,arrId,arrIdInField,fieldId;
4533 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4534 PyObject *res=PyList_New(4);
4535 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4536 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4537 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4538 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4542 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4544 int meshId,arrId,arrIdInField,fieldId;
4545 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4546 PyObject *res=PyList_New(4);
4547 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4548 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4549 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4550 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4556 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4559 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4560 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4564 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4566 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4567 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4569 std::vector<MEDCouplingFieldDouble *> fs(sz);
4570 for(int i=0;i<sz;i++)
4571 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4572 return MEDCouplingFieldOverTime::New(fs);
4574 std::string __str__() const throw(INTERP_KERNEL::Exception)
4576 return self->simpleRepr();
4578 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4580 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4581 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4583 std::vector<MEDCouplingFieldDouble *> fs(sz);
4584 for(int i=0;i<sz;i++)
4585 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4586 return MEDCouplingFieldOverTime::New(fs);
4591 class MEDCouplingCartesianAMRMesh;
4593 class MEDCouplingCartesianAMRPatch : public RefCountObject
4596 int getNumberOfCellsRecursiveWithOverlap() const throw(INTERP_KERNEL::Exception);
4597 int getNumberOfCellsRecursiveWithoutOverlap() const throw(INTERP_KERNEL::Exception);
4598 int getMaxNumberOfLevelsRelativeToThis() const throw(INTERP_KERNEL::Exception);
4599 int getNumberOfOverlapedCellsForFather() const throw(INTERP_KERNEL::Exception);
4602 PyObject *getBLTRRange() const throw(INTERP_KERNEL::Exception)
4604 const std::vector< std::pair<int,int> >& ret(self->getBLTRRange());
4605 return convertFromVectorPairInt(ret);
4608 MEDCouplingCartesianAMRMesh *getMesh() const throw(INTERP_KERNEL::Exception)
4610 MEDCouplingCartesianAMRMesh *ret(const_cast<MEDCouplingCartesianAMRMesh *>(self->getMesh()));
4616 void addPatch(PyObject *bottomLeftTopRight, int factor) throw(INTERP_KERNEL::Exception)
4618 std::vector< std::pair<int,int> > inp;
4619 convertPyToVectorPairInt(bottomLeftTopRight,inp);
4620 self->addPatch(inp,factor);
4623 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const throw(INTERP_KERNEL::Exception)
4625 const MEDCouplingCartesianAMRMesh *mesh(self->getMesh());
4627 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__getitem__ : no underlying mesh !");
4628 if(patchId==mesh->getNumberOfPatches())
4630 std::ostringstream oss;
4631 oss << "Requesting for patchId " << patchId << " having only " << mesh->getNumberOfPatches() << " patches !";
4632 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4635 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(mesh->getPatch(patchId)));
4641 void __delitem__(int patchId) throw(INTERP_KERNEL::Exception)
4643 MEDCouplingCartesianAMRMesh *mesh(const_cast<MEDCouplingCartesianAMRMesh *>(self->getMesh()));
4645 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__delitem__ : no underlying mesh !");
4646 mesh->removePatch(patchId);
4649 int __len__() const throw(INTERP_KERNEL::Exception)
4651 const MEDCouplingCartesianAMRMesh *mesh(self->getMesh());
4653 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__len__ : no underlying mesh !");
4654 return mesh->getNumberOfPatches();
4659 class MEDCouplingCartesianAMRMesh : public RefCountObject, public TimeLabel
4663 int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
4664 int getMaxNumberOfLevelsRelativeToThis() const throw(INTERP_KERNEL::Exception);
4665 int getNumberOfCellsAtCurrentLevel() const throw(INTERP_KERNEL::Exception);
4666 int getNumberOfCellsRecursiveWithOverlap() const throw(INTERP_KERNEL::Exception);
4667 int getNumberOfCellsRecursiveWithoutOverlap() const throw(INTERP_KERNEL::Exception);
4669 int getNumberOfPatches() const throw(INTERP_KERNEL::Exception);
4670 MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
4671 void removePatch(int patchId) throw(INTERP_KERNEL::Exception);
4672 void detachFromFather() throw(INTERP_KERNEL::Exception);
4675 static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
4677 static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !";
4678 static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !";
4679 const int *nodeStrctPtr(0);
4680 const double *originPtr(0),*dxyzPtr(0);
4682 std::vector<int> bb0;
4683 nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
4686 std::vector<double> bb,bb2;
4688 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
4689 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
4691 return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
4694 MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
4696 return ParaMEDMEM_MEDCouplingCartesianAMRMesh_New(meshName,spaceDim,nodeStrct,origin,dxyz);
4699 void addPatch(PyObject *bottomLeftTopRight, int factor) throw(INTERP_KERNEL::Exception)
4701 std::vector< std::pair<int,int> > inp;
4702 convertPyToVectorPairInt(bottomLeftTopRight,inp);
4703 self->addPatch(inp,factor);
4706 MEDCouplingCartesianAMRMesh *getFather() const throw(INTERP_KERNEL::Exception)
4708 MEDCouplingCartesianAMRMesh *ret(const_cast<MEDCouplingCartesianAMRMesh *>(self->getFather()));
4714 MEDCouplingCartesianAMRMesh *getGodFather() const throw(INTERP_KERNEL::Exception)
4716 MEDCouplingCartesianAMRMesh *ret(const_cast<MEDCouplingCartesianAMRMesh *>(self->getGodFather()));
4722 MEDCouplingCartesianAMRPatch *getPatch(int patchId) const throw(INTERP_KERNEL::Exception)
4724 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
4730 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const throw(INTERP_KERNEL::Exception)
4732 if(patchId==self->getNumberOfPatches())
4734 std::ostringstream oss;
4735 oss << "Requesting for patchId " << patchId << " having only " << self->getNumberOfPatches() << " patches !";
4736 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4739 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
4745 void __delitem__(int patchId) throw(INTERP_KERNEL::Exception)
4747 self->removePatch(patchId);
4750 int __len__() const throw(INTERP_KERNEL::Exception)
4752 return self->getNumberOfPatches();
4760 __filename=os.environ.get('PYTHONSTARTUP')
4761 if __filename and os.path.isfile(__filename):
4762 execfile(__filename)