1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
27 #include "MEDCouplingMemArray.hxx"
28 #include "MEDCouplingUMesh.hxx"
29 #include "MEDCouplingExtrudedMesh.hxx"
30 #include "MEDCouplingCMesh.hxx"
31 #include "MEDCouplingCurveLinearMesh.hxx"
32 #include "MEDCoupling1GTUMesh.hxx"
33 #include "MEDCouplingField.hxx"
34 #include "MEDCouplingFieldDouble.hxx"
35 #include "MEDCouplingFieldTemplate.hxx"
36 #include "MEDCouplingGaussLocalization.hxx"
37 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
38 #include "MEDCouplingMultiFields.hxx"
39 #include "MEDCouplingFieldOverTime.hxx"
40 #include "MEDCouplingDefinitionTime.hxx"
41 #include "MEDCouplingFieldDiscretization.hxx"
42 #include "MEDCouplingTypemaps.i"
44 #include "InterpKernelAutoPtr.hxx"
46 using namespace ParaMEDMEM;
47 using namespace INTERP_KERNEL;
51 %template(ivec) std::vector<int>;
52 %template(dvec) std::vector<double>;
53 %template(svec) std::vector<std::string>;
56 %typemap(out) ParaMEDMEM::MEDCouplingMesh*
58 $result=convertMesh($1,$owner);
61 %typemap(out) MEDCouplingMesh*
63 $result=convertMesh($1,$owner);
68 %typemap(out) ParaMEDMEM::MEDCouplingPointSet*
70 $result=convertMesh($1,$owner);
73 %typemap(out) MEDCouplingPointSet*
75 $result=convertMesh($1,$owner);
81 %typemap(out) ParaMEDMEM::MEDCoupling1GTUMesh*
83 $result=convertMesh($1,$owner);
86 %typemap(out) MEDCoupling1GTUMesh*
88 $result=convertMesh($1,$owner);
93 %typemap(out) ParaMEDMEM::MEDCouplingStructuredMesh*
95 $result=convertMesh($1,$owner);
98 %typemap(out) MEDCouplingStructuredMesh*
100 $result=convertMesh($1,$owner);
105 %typemap(out) ParaMEDMEM::MEDCouplingFieldDiscretization*
107 $result=convertFieldDiscretization($1,$owner);
110 %typemap(out) MEDCouplingFieldDiscretization*
112 $result=convertFieldDiscretization($1,$owner);
117 %typemap(out) ParaMEDMEM::MEDCouplingMultiFields*
119 $result=convertMultiFields($1,$owner);
122 %typemap(out) MEDCouplingMultiFields*
124 $result=convertMultiFields($1,$owner);
129 %init %{ import_array(); %}
132 %feature("autodoc", "1");
133 %feature("docstring");
135 %newobject ParaMEDMEM::MEDCouplingField::buildMeasureField;
136 %newobject ParaMEDMEM::MEDCouplingField::getLocalizationOfDiscr;
137 %newobject ParaMEDMEM::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
138 %newobject ParaMEDMEM::MEDCouplingFieldDouble::New;
139 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getArray;
140 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getEndArray;
141 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MergeFields;
142 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MeldFields;
143 %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct;
144 %newobject ParaMEDMEM::MEDCouplingFieldDouble::determinant;
145 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenValues;
146 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenVectors;
147 %newobject ParaMEDMEM::MEDCouplingFieldDouble::inverse;
148 %newobject ParaMEDMEM::MEDCouplingFieldDouble::trace;
149 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deviator;
150 %newobject ParaMEDMEM::MEDCouplingFieldDouble::magnitude;
151 %newobject ParaMEDMEM::MEDCouplingFieldDouble::maxPerTuple;
152 %newobject ParaMEDMEM::MEDCouplingFieldDouble::keepSelectedComponents;
153 %newobject ParaMEDMEM::MEDCouplingFieldDouble::extractSlice3D;
154 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DotFields;
155 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dot;
156 %newobject ParaMEDMEM::MEDCouplingFieldDouble::CrossProductFields;
157 %newobject ParaMEDMEM::MEDCouplingFieldDouble::crossProduct;
158 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MaxFields;
159 %newobject ParaMEDMEM::MEDCouplingFieldDouble::max;
160 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MinFields;
161 %newobject ParaMEDMEM::MEDCouplingFieldDouble::AddFields;
162 %newobject ParaMEDMEM::MEDCouplingFieldDouble::SubstractFields;
163 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MultiplyFields;
164 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DivideFields;
165 %newobject ParaMEDMEM::MEDCouplingFieldDouble::min;
166 %newobject ParaMEDMEM::MEDCouplingFieldDouble::negate;
167 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getIdsInRange;
168 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart;
169 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPartRange;
170 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__getitem__;
171 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__neg__;
172 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__add__;
173 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__sub__;
174 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__mul__;
175 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__div__;
176 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__pow__;
177 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__radd__;
178 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rsub__;
179 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rmul__;
180 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rdiv__;
181 %newobject ParaMEDMEM::MEDCouplingFieldDouble::clone;
182 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cloneWithMesh;
183 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy;
184 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
185 %newobject ParaMEDMEM::MEDCouplingFieldDouble::nodeToCellDiscretization;
186 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cellToNodeDiscretization;
187 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
188 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
189 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
190 %newobject ParaMEDMEM::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
191 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
192 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfNodesPerCell;
193 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfFacesPerCell;
194 %newobject ParaMEDMEM::MEDCouplingMesh::computeEffectiveNbOfNodesPerCell;
195 %newobject ParaMEDMEM::MEDCouplingMesh::buildPartRange;
196 %newobject ParaMEDMEM::MEDCouplingMesh::giveCellsWithType;
197 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
198 %newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
199 %newobject ParaMEDMEM::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
200 %newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
201 %newobject ParaMEDMEM::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
202 %newobject ParaMEDMEM::MEDCouplingMesh::mergeMyselfWith;
203 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic;
204 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic2;
205 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic3;
206 %newobject ParaMEDMEM::MEDCouplingMesh::getMeasureField;
207 %newobject ParaMEDMEM::MEDCouplingMesh::simplexize;
208 %newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured;
209 %newobject ParaMEDMEM::MEDCouplingMesh::MergeMeshes;
210 %newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer;
211 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellsInBoundingBox;
212 %newobject ParaMEDMEM::MEDCouplingPointSet::findBoundaryNodes;
213 %newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh;
214 %newobject ParaMEDMEM::MEDCouplingPointSet::MergeNodesArray;
215 %newobject ParaMEDMEM::MEDCouplingPointSet::buildPartOfMySelf2;
216 %newobject ParaMEDMEM::MEDCouplingPointSet::BuildInstanceFromMeshType;
217 %newobject ParaMEDMEM::MEDCouplingPointSet::zipConnectivityTraducer;
218 %newobject ParaMEDMEM::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
219 %newobject ParaMEDMEM::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
220 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellIdsLyingOnNodes;
221 %newobject ParaMEDMEM::MEDCouplingPointSet::deepCpyConnectivityOnly;
222 %newobject ParaMEDMEM::MEDCouplingPointSet::getBoundingBoxForBBTree;
223 %newobject ParaMEDMEM::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells;
224 %newobject ParaMEDMEM::MEDCouplingPointSet::__getitem__;
225 %newobject ParaMEDMEM::MEDCouplingUMesh::New;
226 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
227 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
228 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
229 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
230 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
231 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
232 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
233 %newobject ParaMEDMEM::MEDCouplingUMesh::explode3DMeshTo1D;
234 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
235 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
236 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
237 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
238 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
239 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
240 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
241 %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
242 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
243 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
244 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
245 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
246 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
247 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
248 %newobject ParaMEDMEM::MEDCouplingUMesh::convertLinearCellsToQuadratic;
249 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
250 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
251 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
252 %newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField;
253 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner;
254 %newobject ParaMEDMEM::MEDCouplingUMesh::computePlaneEquationOf3DFaces;
255 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField;
256 %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
257 %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
258 %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
259 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
260 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
261 %newobject ParaMEDMEM::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
262 %newobject ParaMEDMEM::MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh;
263 %newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
264 %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
265 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis;
266 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsCrossingPlane;
267 %newobject ParaMEDMEM::MEDCouplingUMesh::convexEnvelop2D;
268 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
269 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf2DMesh;
270 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf3DMesh;
271 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
272 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
273 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
274 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
275 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::New;
276 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::getNodalConnectivity;
277 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
278 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::New;
279 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
280 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::computeDualMesh;
281 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
282 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::sortHexa8EachOther;
283 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
284 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
285 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::New;
286 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
287 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
288 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
289 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
290 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
291 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
292 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::buildStructuredSubPart;
293 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTUnstructured;
294 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
295 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
296 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
297 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
298 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
299 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
300 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
301 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
302 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
303 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
304 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
306 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
307 %feature("unref") MEDCouplingMesh "$this->decrRef();"
308 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
309 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
310 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
311 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
312 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
313 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
314 %feature("unref") MEDCouplingField "$this->decrRef();"
315 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
316 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
317 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
318 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
319 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
320 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
321 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
322 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
323 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
325 %rename(assign) *::operator=;
326 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
327 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
328 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
329 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
333 %rename (InterpKernelException) INTERP_KERNEL::Exception;
335 %include "MEDCouplingRefCountObject.i"
336 %include "MEDCouplingMemArray.i"
354 CONST_ON_TIME_INTERVAL = 7
355 } TypeOfTimeDiscretization;
363 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
364 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11
365 } MEDCouplingMeshType;
368 class DataArrayDouble;
369 class MEDCouplingUMesh;
370 class MEDCouplingFieldDouble;
372 %extend RefCountObject
374 std::string getHiddenCppPointer() const
376 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
381 %extend MEDCouplingGaussLocalization
383 std::string __str__() const throw(INTERP_KERNEL::Exception)
385 return self->getStringRepr();
388 std::string __repr__() const throw(INTERP_KERNEL::Exception)
390 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
391 oss << self->getStringRepr();
398 class MEDCouplingMesh : public RefCountObject, public TimeLabel
401 void setName(const std::string& name);
402 std::string getName() const;
403 void setDescription(const std::string& descr);
404 std::string getDescription() const;
405 void setTime(double val, int iteration, int order);
406 void setTimeUnit(const std::string& unit);
407 std::string getTimeUnit() const;
408 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
409 bool isStructured() const throw(INTERP_KERNEL::Exception);
410 virtual MEDCouplingMesh *deepCpy() const;
411 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
412 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
413 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
414 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
415 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
416 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
417 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
418 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
419 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
420 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
421 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
422 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
423 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
424 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
425 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
426 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
427 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
428 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
429 virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
430 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
431 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
432 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
433 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
434 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
435 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
437 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
438 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
439 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
440 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
441 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception);
442 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
443 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
444 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
445 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
446 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
447 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
448 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
449 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
450 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
451 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
452 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
453 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
456 std::string __str__() const throw(INTERP_KERNEL::Exception)
458 return self->simpleRepr();
461 PyObject *getTime() throw(INTERP_KERNEL::Exception)
464 double tmp0=self->getTime(tmp1,tmp2);
465 PyObject *res = PyList_New(3);
466 PyList_SetItem(res,0,SWIG_From_double(tmp0));
467 PyList_SetItem(res,1,SWIG_From_int(tmp1));
468 PyList_SetItem(res,2,SWIG_From_int(tmp2));
472 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
476 DataArrayDoubleTuple *aa;
477 std::vector<double> bb;
479 int spaceDim=self->getSpaceDimension();
480 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
481 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
482 return self->getCellContainingPoint(pos,eps);
485 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
489 DataArrayDoubleTuple *aa;
490 std::vector<double> bb;
492 int spaceDim=self->getSpaceDimension();
493 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
494 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
495 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
496 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
497 PyObject *ret=PyTuple_New(2);
498 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
499 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
503 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
505 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
506 int spaceDim=self->getSpaceDimension();
508 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
509 if (!SWIG_IsOK(res1))
512 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
513 int nbOfPoints=size/spaceDim;
516 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
518 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
522 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
524 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
525 da2->checkAllocated();
526 int size=da2->getNumberOfTuples();
527 int nbOfCompo=da2->getNumberOfComponents();
528 if(nbOfCompo!=spaceDim)
530 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
532 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
534 PyObject *ret=PyTuple_New(2);
535 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
536 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
540 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
544 DataArrayDoubleTuple *aa;
545 std::vector<double> bb;
547 int spaceDim=self->getSpaceDimension();
548 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
549 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
550 std::vector<int> elts;
551 self->getCellsContainingPoint(pos,eps,elts);
552 DataArrayInt *ret=DataArrayInt::New();
553 ret->alloc((int)elts.size(),1);
554 std::copy(elts.begin(),elts.end(),ret->getPointer());
555 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
558 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
560 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
561 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
562 self->getReverseNodalConnectivity(d0,d1);
563 PyObject *ret=PyTuple_New(2);
564 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
565 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
569 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
572 int v0; std::vector<int> v1;
573 const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
574 self->renumberCells(ids,check);
577 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
579 DataArrayInt *cellCor, *nodeCor;
580 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
581 PyObject *res = PyList_New(2);
582 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
583 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
587 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
589 DataArrayInt *cellCor=0,*nodeCor=0;
590 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
591 PyObject *res = PyList_New(2);
592 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
593 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
597 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
599 DataArrayInt *cellCor=0;
600 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
604 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
607 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
608 if (!SWIG_IsOK(res1))
611 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
612 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
616 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
618 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
619 da2->checkAllocated();
620 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
623 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
625 std::vector<int> conn;
626 self->getNodeIdsOfCell(cellId,conn);
627 return convertIntArrToPyList2(conn);
630 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
632 std::vector<double> coo;
633 self->getCoordinatesOfNode(nodeId,coo);
634 return convertDblArrToPyList2(coo);
637 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
641 DataArrayDoubleTuple *aa;
642 std::vector<double> bb;
644 int spaceDim=self->getSpaceDimension();
645 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
646 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
647 self->scale(pointPtr,factor);
650 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
652 int spaceDim=self->getSpaceDimension();
653 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
654 self->getBoundingBox(tmp);
655 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
659 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
662 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
663 PyObject *ret=PyTuple_New(2);
664 PyObject *ret0Py=ret0?Py_True:Py_False;
666 PyTuple_SetItem(ret,0,ret0Py);
667 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
671 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
673 int szArr,sw,iTypppArr;
674 std::vector<int> stdvecTyyppArr;
675 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
676 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
677 if(sw==3)//DataArrayInt
679 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
680 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
681 std::string name=argpt->getName();
683 ret->setName(name.c_str());
685 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
688 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
690 int szArr,sw,iTypppArr;
691 std::vector<int> stdvecTyyppArr;
693 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
694 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
695 if(sw==3)//DataArrayInt
697 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
698 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
699 std::string name=argpt->getName();
701 ret->setName(name.c_str());
704 PyObject *res = PyList_New(2);
705 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
706 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
707 PyList_SetItem(res,0,obj0);
708 PyList_SetItem(res,1,obj1);
712 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
716 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
717 PyObject *res = PyTuple_New(2);
718 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
721 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
723 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
724 PyTuple_SetItem(res,0,obj0);
725 PyTuple_SetItem(res,1,obj1);
729 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
731 std::vector<int> vals=self->getDistributionOfTypes();
733 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
734 PyObject *ret=PyList_New((int)vals.size()/3);
735 for(int j=0;j<(int)vals.size()/3;j++)
737 PyObject *ret1=PyList_New(3);
738 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
739 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
740 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
741 PyList_SetItem(ret,j,ret1);
746 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
748 std::vector<int> code;
749 std::vector<const DataArrayInt *> idsPerType;
750 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
751 convertPyToNewIntArr4(li,1,3,code);
752 return self->checkTypeConsistencyAndContig(code,idsPerType);
755 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
757 std::vector<int> code;
758 std::vector<DataArrayInt *> idsInPflPerType;
759 std::vector<DataArrayInt *> idsPerType;
760 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
761 PyObject *ret=PyTuple_New(3);
764 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
765 PyObject *ret0=PyList_New((int)code.size()/3);
766 for(int j=0;j<(int)code.size()/3;j++)
768 PyObject *ret00=PyList_New(3);
769 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
770 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
771 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
772 PyList_SetItem(ret0,j,ret00);
774 PyTuple_SetItem(ret,0,ret0);
776 PyObject *ret1=PyList_New(idsInPflPerType.size());
777 for(std::size_t j=0;j<idsInPflPerType.size();j++)
778 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
779 PyTuple_SetItem(ret,1,ret1);
780 int n=idsPerType.size();
781 PyObject *ret2=PyList_New(n);
783 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
784 PyTuple_SetItem(ret,2,ret2);
788 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
792 DataArrayDoubleTuple *aa;
793 std::vector<double> bb;
795 int spaceDim=self->getSpaceDimension();
796 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
797 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
798 self->translate(vectorPtr);
801 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
803 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
806 DataArrayDoubleTuple *aa;
807 std::vector<double> bb;
809 int spaceDim=self->getSpaceDimension();
810 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
811 self->rotate(centerPtr,0,alpha);
814 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
816 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
818 DataArrayDouble *a,*a2;
819 DataArrayDoubleTuple *aa,*aa2;
820 std::vector<double> bb,bb2;
822 int spaceDim=self->getSpaceDimension();
823 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
824 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
825 self->rotate(centerPtr,vectorPtr,alpha);
828 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
830 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
831 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
832 PyObject *res=PyList_New(result.size());
833 for(int i=0;iL!=result.end(); i++, iL++)
834 PyList_SetItem(res,i,PyInt_FromLong(*iL));
838 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
840 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
841 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
842 return MEDCouplingMesh::MergeMeshes(tmp);
848 //== MEDCouplingMesh End
850 %include "NormalizedGeometricTypes"
851 %include "MEDCouplingNatureOfFieldEnum"
855 class MEDCouplingNatureOfField
858 static const char *GetRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception);
859 static std::string GetReprNoThrow(NatureOfField nat);
860 static std::string GetAllPossibilitiesStr();
864 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
865 // include "MEDCouplingTimeDiscretization.i"
869 class MEDCouplingGaussLocalization
872 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
873 const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
874 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
875 INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
876 void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
877 int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
878 int getDimension() const throw(INTERP_KERNEL::Exception);
879 int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
880 std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
881 void checkCoherency() const throw(INTERP_KERNEL::Exception);
882 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception);
884 const std::vector<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
885 double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
886 const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
887 double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
888 const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
889 double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
890 void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
891 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
892 void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
893 void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
894 void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
895 void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
897 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
901 %include "MEDCouplingFieldDiscretization.i"
903 //== MEDCouplingPointSet
907 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
910 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
911 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
912 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
913 void zipCoords() throw(INTERP_KERNEL::Exception);
914 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
915 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
916 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
917 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
918 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
919 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
920 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
921 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
922 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
923 static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception);
924 virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
925 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
926 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
927 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
928 virtual DataArrayInt *findBoundaryNodes() const;
929 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
930 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
931 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
932 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
933 virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
934 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
937 std::string __str__() const throw(INTERP_KERNEL::Exception)
939 return self->simpleRepr();
942 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
945 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
946 PyObject *res = PyList_New(2);
947 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
948 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
952 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
954 DataArrayInt *comm, *commIndex;
955 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
956 PyObject *res = PyList_New(2);
957 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
958 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
962 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
964 DataArrayDouble *ret1=self->getCoords();
967 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
970 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
972 int szArr,sw,iTypppArr;
973 std::vector<int> stdvecTyyppArr;
974 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
975 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
976 if(sw==3)//DataArrayInt
978 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
979 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
980 std::string name=argpt->getName();
982 ret->setName(name.c_str());
984 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
987 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
989 int szArr,sw,iTypppArr;
990 std::vector<int> stdvecTyyppArr;
991 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
992 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
993 if(sw==3)//DataArrayInt
995 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
996 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
997 std::string name=argpt->getName();
999 ret->setName(name.c_str());
1001 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1004 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
1006 int szArr,sw,iTypppArr;
1007 std::vector<int> stdvecTyyppArr;
1008 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1009 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1010 if(sw==3)//DataArrayInt
1012 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1013 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1014 std::string name=argpt->getName();
1016 ret->setName(name.c_str());
1018 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1021 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1023 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1024 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1027 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1029 int szArr,sw,iTypppArr;
1030 std::vector<int> stdvecTyyppArr;
1031 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1032 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1033 if(sw==3)//DataArrayInt
1035 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1036 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1037 std::string name=argpt->getName();
1039 ret->setName(name.c_str());
1041 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1044 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1046 int szArr,sw,iTypppArr;
1047 std::vector<int> stdvecTyyppArr;
1048 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1049 self->renumberNodes(tmp,newNbOfNodes);
1052 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1054 int szArr,sw,iTypppArr;
1055 std::vector<int> stdvecTyyppArr;
1056 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1057 self->renumberNodes2(tmp,newNbOfNodes);
1060 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1062 int spaceDim=self->getSpaceDimension();
1064 DataArrayDouble *a,*a2;
1065 DataArrayDoubleTuple *aa,*aa2;
1066 std::vector<double> bb,bb2;
1068 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1069 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1070 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1071 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1072 std::vector<int> nodes;
1073 self->findNodesOnLine(p,v,eps,nodes);
1074 DataArrayInt *ret=DataArrayInt::New();
1075 ret->alloc((int)nodes.size(),1);
1076 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1077 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1079 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1081 int spaceDim=self->getSpaceDimension();
1083 DataArrayDouble *a,*a2;
1084 DataArrayDoubleTuple *aa,*aa2;
1085 std::vector<double> bb,bb2;
1087 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1088 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1089 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1090 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1091 std::vector<int> nodes;
1092 self->findNodesOnPlane(p,v,eps,nodes);
1093 DataArrayInt *ret=DataArrayInt::New();
1094 ret->alloc((int)nodes.size(),1);
1095 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1096 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1099 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1103 DataArrayDoubleTuple *aa;
1104 std::vector<double> bb;
1106 int spaceDim=self->getSpaceDimension();
1107 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1108 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1109 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1110 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1113 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1115 DataArrayInt *c=0,*cI=0;
1119 DataArrayDoubleTuple *aa;
1120 std::vector<double> bb;
1122 int spaceDim=self->getSpaceDimension();
1123 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1124 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1125 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1126 PyObject *ret=PyTuple_New(2);
1127 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1128 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1132 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1134 DataArrayInt *c=0,*cI=0;
1135 int spaceDim=self->getSpaceDimension();
1138 DataArrayDoubleTuple *aa;
1139 std::vector<double> bb;
1142 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1143 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1145 PyObject *ret=PyTuple_New(2);
1146 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1147 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1151 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1155 DataArrayDoubleTuple *aa;
1156 std::vector<double> bb;
1158 int spaceDim=self->getSpaceDimension();
1159 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1160 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1162 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1163 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1166 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1170 std::vector<int> multiVal;
1171 std::pair<int, std::pair<int,int> > slic;
1172 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1173 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1177 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1179 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1181 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1183 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1187 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1189 DataArrayInt *v0=0,*v1=0;
1190 self->findCommonCells(compType,startCellId,v0,v1);
1191 PyObject *res = PyList_New(2);
1192 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1193 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1198 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1201 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1202 if (!SWIG_IsOK(res1))
1205 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1206 self->renumberNodesInConn(tmp);
1210 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1212 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1213 da2->checkAllocated();
1214 self->renumberNodesInConn(da2->getConstPointer());
1218 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1221 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1222 PyObject *ret=PyTuple_New(2);
1223 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1224 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1228 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1230 DataArrayInt *ret=0;
1232 int szArr,sw,iTypppArr;
1233 std::vector<int> stdvecTyyppArr;
1234 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1235 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1239 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1243 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1244 PyObject *res = PyList_New(3);
1245 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1246 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1247 PyList_SetItem(res,2,SWIG_From_int(ret2));
1251 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1255 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1256 PyObject *res = PyList_New(3);
1257 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1258 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1259 PyList_SetItem(res,2,SWIG_From_int(ret2));
1263 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1266 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1267 if (!SWIG_IsOK(res1))
1270 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1271 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1275 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1277 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1278 da2->checkAllocated();
1279 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1283 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1287 std::vector<int> multiVal;
1288 std::pair<int, std::pair<int,int> > slic;
1289 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1290 int nbc=self->getNumberOfCells();
1291 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1298 std::ostringstream oss;
1299 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1300 throw INTERP_KERNEL::Exception(oss.str().c_str());
1303 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1308 int tmp=nbc+singleVal;
1309 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1313 std::ostringstream oss;
1314 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1315 throw INTERP_KERNEL::Exception(oss.str().c_str());
1321 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1325 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1330 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1331 daIntTyypp->checkAllocated();
1332 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1335 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1339 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1342 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1343 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1344 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1345 for(int i=0;i<sz;i++)
1346 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1349 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1352 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1354 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1355 std::vector<double> val3;
1356 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1357 "Rotate2DAlg",2,true,nbNodes);
1359 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1360 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1363 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1366 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1367 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1368 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1369 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1370 for(int i=0;i<sz;i++)
1371 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1374 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1377 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1379 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1380 std::vector<double> val3;
1381 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1382 "Rotate3DAlg",3,true,nbNodes);
1384 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1385 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1386 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1391 //== MEDCouplingPointSet End
1393 class MEDCouplingUMeshCell
1396 INTERP_KERNEL::NormalizedCellType getType() const;
1399 std::string __str__() const throw(INTERP_KERNEL::Exception)
1401 return self->repr();
1404 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1407 const int *r=self->getAllConn(ret2);
1408 PyObject *ret=PyTuple_New(ret2);
1409 for(int i=0;i<ret2;i++)
1410 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1416 class MEDCouplingUMeshCellIterator
1423 MEDCouplingUMeshCell *ret=self->nextt();
1425 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1428 PyErr_SetString(PyExc_StopIteration,"No more data.");
1435 class MEDCouplingUMeshCellByTypeIterator
1438 ~MEDCouplingUMeshCellByTypeIterator();
1443 MEDCouplingUMeshCellEntry *ret=self->nextt();
1445 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1448 PyErr_SetString(PyExc_StopIteration,"No more data.");
1455 class MEDCouplingUMeshCellByTypeEntry
1458 ~MEDCouplingUMeshCellByTypeEntry();
1461 MEDCouplingUMeshCellByTypeIterator *__iter__()
1463 return self->iterator();
1468 class MEDCouplingUMeshCellEntry
1471 INTERP_KERNEL::NormalizedCellType getType() const;
1472 int getNumberOfElems() const;
1475 MEDCouplingUMeshCellIterator *__iter__()
1477 return self->iterator();
1482 //== MEDCouplingUMesh
1484 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1487 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1488 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1489 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1490 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1491 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1492 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1493 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1494 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1495 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1496 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1497 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1498 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1499 void computeTypes() throw(INTERP_KERNEL::Exception);
1500 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1501 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1503 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1504 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1505 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1506 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1507 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1508 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1509 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1510 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1511 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1512 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1513 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1514 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1515 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1516 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1517 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1518 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1519 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1520 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1521 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1522 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1523 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1524 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1525 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1526 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1527 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1528 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1529 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1530 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1531 DataArrayDouble *computePlaneEquationOf3DFaces() const throw(INTERP_KERNEL::Exception);
1532 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1533 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1534 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1535 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1536 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1537 DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1538 DataArrayInt *buildUnionOf2DMesh() const throw(INTERP_KERNEL::Exception);
1539 DataArrayInt *buildUnionOf3DMesh() const throw(INTERP_KERNEL::Exception);
1540 DataArrayDouble *getBoundingBoxForBBTreeFast() const throw(INTERP_KERNEL::Exception);
1541 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1542 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1543 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1544 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1545 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1546 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1548 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1550 return MEDCouplingUMesh::New();
1553 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1555 return MEDCouplingUMesh::New(meshName,meshDim);
1558 std::string __str__() const throw(INTERP_KERNEL::Exception)
1560 return self->simpleRepr();
1563 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1565 std::ostringstream oss;
1566 self->reprQuickOverview(oss);
1570 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1572 return self->cellIterator();
1575 PyObject *getAllGeoTypesSorted() const throw(INTERP_KERNEL::Exception)
1577 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
1578 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1579 PyObject *res=PyList_New(result.size());
1580 for(int i=0;iL!=result.end(); i++, iL++)
1581 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1585 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1589 std::vector<int> multiVal;
1590 std::pair<int, std::pair<int,int> > slic;
1591 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1592 int nbc=self->getNumberOfCells();
1593 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1600 std::ostringstream oss;
1601 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1602 throw INTERP_KERNEL::Exception(oss.str().c_str());
1606 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1613 int tmp=nbc+singleVal;
1614 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1619 std::ostringstream oss;
1620 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1621 throw INTERP_KERNEL::Exception(oss.str().c_str());
1627 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1633 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1634 daIntTyypp->checkAllocated();
1635 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1639 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1643 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1647 std::vector<int> multiVal;
1648 std::pair<int, std::pair<int,int> > slic;
1649 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1650 int nbc=self->getNumberOfCells();
1651 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1658 std::ostringstream oss;
1659 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1660 throw INTERP_KERNEL::Exception(oss.str().c_str());
1664 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1671 int tmp=nbc+singleVal;
1672 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1677 std::ostringstream oss;
1678 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1679 throw INTERP_KERNEL::Exception(oss.str().c_str());
1685 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1690 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1696 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1697 daIntTyypp->checkAllocated();
1698 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1702 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1706 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1708 int szArr,sw,iTypppArr;
1709 std::vector<int> stdvecTyyppArr;
1710 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1713 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1714 throw INTERP_KERNEL::Exception(oss.str().c_str());
1716 self->insertNextCell(type,size,tmp);
1719 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1721 int szArr,sw,iTypppArr;
1722 std::vector<int> stdvecTyyppArr;
1723 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1724 self->insertNextCell(type,szArr,tmp);
1727 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1729 DataArrayInt *ret=self->getNodalConnectivity();
1734 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1736 DataArrayInt *ret=self->getNodalConnectivityIndex();
1742 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1744 int szArr,sw,iTypppArr;
1745 std::vector<int> stdvecTyyppArr;
1746 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1747 int nbOfDepthPeelingPerformed=0;
1748 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1749 PyObject *res=PyTuple_New(2);
1750 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1751 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1755 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1757 DataArrayInt *v0=0,*v1=0;
1758 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1759 PyObject *res = PyList_New(2);
1760 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1761 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1765 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1769 DataArrayDoubleTuple *aa;
1770 std::vector<double> bb;
1772 int nbOfCompo=self->getSpaceDimension();
1773 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1776 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1777 PyObject *ret=PyTuple_New(2);
1778 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1779 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1783 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1785 DataArrayInt *ret1=0;
1786 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1787 PyObject *ret=PyTuple_New(2);
1788 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1789 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1793 PyObject *tetrahedrize(int policy) throw(INTERP_KERNEL::Exception)
1796 DataArrayInt *ret1(0);
1797 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
1798 PyObject *ret=PyTuple_New(3);
1799 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
1800 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1801 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
1805 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1807 std::vector<int> cells;
1808 self->checkButterflyCells(cells,eps);
1809 DataArrayInt *ret=DataArrayInt::New();
1810 ret->alloc((int)cells.size(),1);
1811 std::copy(cells.begin(),cells.end(),ret->getPointer());
1812 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1815 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1817 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1819 PyObject *ret = PyList_New(sz);
1820 for(int i=0;i<sz;i++)
1821 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1825 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1827 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1828 int sz=retCpp.size();
1829 PyObject *ret=PyList_New(sz);
1830 for(int i=0;i<sz;i++)
1831 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1835 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1838 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1839 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1840 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1843 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1846 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1847 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1851 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1854 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1855 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1859 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1861 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1862 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1863 PyObject *ret=PyTuple_New(3);
1864 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1865 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1866 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1870 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1872 DataArrayInt *tmp0=0,*tmp1=0;
1873 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1874 PyObject *ret=PyTuple_New(2);
1875 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1876 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1880 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1884 std::vector<int> multiVal;
1885 std::pair<int, std::pair<int,int> > slic;
1886 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1887 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1891 return self->duplicateNodes(&singleVal,&singleVal+1);
1893 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
1895 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
1897 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1901 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
1905 std::vector<int> multiVal;
1906 std::pair<int, std::pair<int,int> > slic;
1907 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1908 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1912 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
1914 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
1916 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
1918 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1922 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
1925 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1926 DataArrayInt *tmp0,*tmp1=0;
1927 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
1928 PyObject *ret=PyTuple_New(2);
1929 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1930 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1934 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const throw(INTERP_KERNEL::Exception)
1936 DataArrayInt *ret0=0,*ret1=0;
1937 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
1938 PyObject *ret=PyTuple_New(2);
1939 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1940 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1944 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1946 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1947 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1948 DataArrayInt *ret1=0,*ret2=0;
1949 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
1950 PyObject *ret=PyTuple_New(3);
1951 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1952 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1953 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1957 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1959 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1960 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1961 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
1962 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1965 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
1968 std::vector<const MEDCouplingUMesh *> meshes;
1969 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1970 std::vector<DataArrayInt *> corr;
1971 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
1973 PyObject *ret1=PyList_New(sz);
1974 for(int i=0;i<sz;i++)
1975 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1976 PyObject *ret=PyList_New(2);
1977 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1978 PyList_SetItem(ret,1,ret1);
1982 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1984 std::vector<MEDCouplingUMesh *> meshes;
1985 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1986 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
1989 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
1991 std::vector<MEDCouplingUMesh *> meshes;
1992 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1993 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
1996 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
2000 std::vector<int> multiVal;
2001 std::pair<int, std::pair<int,int> > slic;
2002 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2004 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2005 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2009 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2011 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2013 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2015 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2019 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2021 DataArrayInt *arrOut=0,*arrIndexOut=0;
2024 std::vector<int> multiVal;
2025 std::pair<int, std::pair<int,int> > slic;
2026 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2028 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2029 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2034 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2039 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2044 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2048 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2050 PyObject *ret=PyTuple_New(2);
2051 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2052 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2056 static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2058 DataArrayInt *arrOut=0,*arrIndexOut=0;
2059 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2060 PyObject *ret=PyTuple_New(2);
2061 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2062 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2066 static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2068 if(!PySlice_Check(slic))
2069 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !");
2070 Py_ssize_t strt=2,stp=2,step=2;
2071 PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
2073 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !");
2074 arrIndxIn->checkAllocated();
2075 if(arrIndxIn->getNumberOfComponents()!=1)
2076 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !");
2077 if(PySlice_GetIndices(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step)!=0)
2078 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !");
2079 DataArrayInt *arrOut=0,*arrIndexOut=0;
2080 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2081 PyObject *ret=PyTuple_New(2);
2082 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2083 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2087 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2088 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2089 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2091 DataArrayInt *arrOut=0,*arrIndexOut=0;
2094 std::vector<int> multiVal;
2095 std::pair<int, std::pair<int,int> > slic;
2096 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2098 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2099 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2104 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2109 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2114 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2118 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2120 PyObject *ret=PyTuple_New(2);
2121 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2122 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2126 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2127 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2131 std::vector<int> multiVal;
2132 std::pair<int, std::pair<int,int> > slic;
2133 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2135 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2136 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2141 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2146 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2151 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2155 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2159 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2163 DataArrayDoubleTuple *aa;
2164 std::vector<double> bb;
2166 int spaceDim=self->getSpaceDimension();
2167 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2168 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2170 std::vector<int> cells;
2171 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2172 DataArrayInt *ret=DataArrayInt::New();
2173 ret->alloc((int)cells.size(),1);
2174 std::copy(cells.begin(),cells.end(),ret->getPointer());
2175 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2178 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2182 DataArrayDoubleTuple *aa;
2183 std::vector<double> bb;
2185 int spaceDim=self->getSpaceDimension();
2186 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2187 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2188 self->orientCorrectly2DCells(v,polyOnly);
2191 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2193 std::vector<int> cells;
2194 self->arePolyhedronsNotCorrectlyOriented(cells);
2195 DataArrayInt *ret=DataArrayInt::New();
2196 ret->alloc((int)cells.size(),1);
2197 std::copy(cells.begin(),cells.end(),ret->getPointer());
2198 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2201 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2205 self->getFastAveragePlaneOfThis(vec,pos);
2207 std::copy(vec,vec+3,vals);
2208 std::copy(pos,pos+3,vals+3);
2209 return convertDblArrToPyListOfTuple(vals,3,2);
2212 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2214 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2215 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2216 return MEDCouplingUMesh::MergeUMeshes(tmp);
2219 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2222 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2223 PyObject *ret=PyTuple_New(2);
2224 PyObject *ret0Py=ret0?Py_True:Py_False;
2226 PyTuple_SetItem(ret,0,ret0Py);
2227 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2231 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2234 bool ret0=self->areCellsIncludedIn2(other,ret1);
2235 PyObject *ret=PyTuple_New(2);
2236 PyObject *ret0Py=ret0?Py_True:Py_False;
2238 PyTuple_SetItem(ret,0,ret0Py);
2239 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2243 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2245 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2246 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2247 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2248 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2249 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2250 PyObject *ret=PyTuple_New(5);
2251 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2252 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2253 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2254 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2255 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2259 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2261 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2262 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2263 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2264 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2265 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2266 PyObject *ret=PyTuple_New(5);
2267 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2268 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2269 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2270 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2271 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2275 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2277 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2278 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2279 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2280 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2281 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2282 PyObject *ret=PyTuple_New(5);
2283 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2284 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2285 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2286 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2287 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2291 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2293 DataArrayInt *neighbors=0,*neighborsIdx=0;
2294 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2295 PyObject *ret=PyTuple_New(2);
2296 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2297 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2301 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2303 DataArrayInt *neighbors=0,*neighborsIdx=0;
2304 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2305 PyObject *ret=PyTuple_New(2);
2306 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2307 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2311 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2313 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2314 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2315 DataArrayInt *d2,*d3,*d4,*dd5;
2316 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2317 PyObject *ret=PyTuple_New(7);
2318 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2319 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2320 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2321 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2322 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2323 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2324 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2328 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2331 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2332 da->checkAllocated();
2333 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2336 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2339 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2340 da->checkAllocated();
2341 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2344 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2347 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2348 da->checkAllocated();
2349 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2352 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2355 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2356 da->checkAllocated();
2357 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2358 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2359 PyObject *res = PyList_New(result.size());
2360 for (int i=0;iL!=result.end(); i++, iL++)
2361 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2365 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2368 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2369 da->checkAllocated();
2370 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2371 ret->setName(da->getName().c_str());
2375 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2377 DataArrayInt *cellNb1=0,*cellNb2=0;
2378 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2379 PyObject *ret=PyTuple_New(3);
2380 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2381 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2382 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2386 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2388 int spaceDim=self->getSpaceDimension();
2390 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2392 DataArrayDouble *a,*a2;
2393 DataArrayDoubleTuple *aa,*aa2;
2394 std::vector<double> bb,bb2;
2396 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2397 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2398 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2399 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2401 DataArrayInt *cellIds=0;
2402 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2403 PyObject *ret=PyTuple_New(2);
2404 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2405 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2409 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2411 int spaceDim=self->getSpaceDimension();
2413 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2415 DataArrayDouble *a,*a2;
2416 DataArrayDoubleTuple *aa,*aa2;
2417 std::vector<double> bb,bb2;
2419 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2420 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2421 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2422 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2424 DataArrayInt *cellIds=0;
2425 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2426 PyObject *ret=PyTuple_New(2);
2427 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2428 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2432 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2434 int spaceDim=self->getSpaceDimension();
2436 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2438 DataArrayDouble *a,*a2;
2439 DataArrayDoubleTuple *aa,*aa2;
2440 std::vector<double> bb,bb2;
2442 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2443 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2444 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2445 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2446 return self->getCellIdsCrossingPlane(orig,vect,eps);
2449 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2453 std::vector<int> pos2;
2454 DataArrayInt *pos3=0;
2455 DataArrayIntTuple *pos4=0;
2456 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2461 self->convertToPolyTypes(&pos1,&pos1+1);
2468 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2473 self->convertToPolyTypes(pos3->begin(),pos3->end());
2477 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2481 void convertAllToPoly();
2482 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2483 bool unPolyze() throw(INTERP_KERNEL::Exception);
2484 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2485 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2486 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2489 //== MEDCouplingUMesh End
2491 //== MEDCouplingExtrudedMesh
2493 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2496 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2497 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2499 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2501 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2504 std::string __str__() const throw(INTERP_KERNEL::Exception)
2506 return self->simpleRepr();
2509 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2511 std::ostringstream oss;
2512 self->reprQuickOverview(oss);
2516 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2518 MEDCouplingUMesh *ret=self->getMesh2D();
2521 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2523 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2525 MEDCouplingUMesh *ret=self->getMesh1D();
2528 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2530 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2532 DataArrayInt *ret=self->getMesh3DIds();
2535 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2540 //== MEDCouplingExtrudedMesh End
2542 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2545 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2546 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2547 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2548 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2549 virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2550 virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
2553 virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2555 int szArr,sw,iTypppArr;
2556 std::vector<int> stdvecTyyppArr;
2557 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2558 self->insertNextCell(tmp,tmp+szArr);
2561 virtual DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2563 DataArrayInt *ret=self->getNodalConnectivity();
2564 if(ret) ret->incrRef();
2568 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2570 std::vector< const MEDCoupling1GTUMesh *> parts;
2571 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
2572 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
2577 //== MEDCoupling1SGTUMesh
2579 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2582 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2583 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2584 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2585 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2586 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2587 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2588 MEDCoupling1GTUMesh *computeDualMesh() const throw(INTERP_KERNEL::Exception);
2589 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const throw(INTERP_KERNEL::Exception);
2590 DataArrayInt *sortHexa8EachOther() throw(INTERP_KERNEL::Exception);
2593 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2595 return MEDCoupling1SGTUMesh::New(name,type);
2598 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2600 return MEDCoupling1SGTUMesh::New(m);
2603 std::string __str__() const throw(INTERP_KERNEL::Exception)
2605 return self->simpleRepr();
2608 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2610 std::ostringstream oss;
2611 self->reprQuickOverview(oss);
2615 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2617 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2618 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2619 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2622 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2624 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2625 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2626 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2631 //== MEDCoupling1SGTUMesh End
2633 //== MEDCoupling1DGTUMesh
2635 class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2638 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2639 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2640 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
2641 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2642 bool isPacked() const throw(INTERP_KERNEL::Exception);
2645 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2647 return MEDCoupling1DGTUMesh::New(name,type);
2650 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2652 return MEDCoupling1DGTUMesh::New(m);
2655 std::string __str__() const throw(INTERP_KERNEL::Exception)
2657 return self->simpleRepr();
2660 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2662 std::ostringstream oss;
2663 self->reprQuickOverview(oss);
2667 DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
2669 DataArrayInt *ret=self->getNodalConnectivityIndex();
2670 if(ret) ret->incrRef();
2674 PyObject *retrievePackedNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2676 DataArrayInt *ret1=0,*ret2=0;
2677 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
2678 PyObject *ret0Py=ret0?Py_True:Py_False;
2680 PyObject *ret=PyTuple_New(3);
2681 PyTuple_SetItem(ret,0,ret0Py);
2682 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2683 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2687 PyObject *copyWithNodalConnectivityPacked() const throw(INTERP_KERNEL::Exception)
2690 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
2691 PyObject *ret=PyTuple_New(2);
2692 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
2693 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
2694 PyTuple_SetItem(ret,1,ret1Py);
2698 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2700 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2701 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2702 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
2705 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2707 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2708 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2709 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
2712 static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt) throw(INTERP_KERNEL::Exception)
2714 std::vector<const ParaMEDMEM::DataArrayInt *> tmp;
2715 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2716 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
2721 //== MEDCoupling1DGTUMeshEnd
2723 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2726 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2727 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2728 virtual std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2729 std::vector<int> getCellGridStructure() const throw(INTERP_KERNEL::Exception);
2730 MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception);
2731 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
2734 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const throw(INTERP_KERNEL::Exception)
2736 int tmpp1=-1,tmpp2=-1;
2737 std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
2738 std::vector< std::pair<int,int> > inp;
2742 for(int i=0;i<tmpp1;i++)
2743 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2748 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
2749 inp.resize(tmpp1/2);
2750 for(int i=0;i<tmpp1/2;i++)
2751 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2754 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
2755 return self->buildStructuredSubPart(inp);
2758 static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) throw(INTERP_KERNEL::Exception)
2760 int tmpp1=-1,tmpp2=-1;
2761 std::vector<int> tmp=fillArrayWithPyListInt2(part,tmpp1,tmpp2);
2762 std::vector< std::pair<int,int> > inp;
2766 for(int i=0;i<tmpp1;i++)
2767 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2772 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.BuildExplicitIdsFrom : invalid input size ! Must be even size !");
2773 inp.resize(tmpp1/2);
2774 for(int i=0;i<tmpp1/2;i++)
2775 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2778 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.BuildExplicitIdsFrom : invalid input size !");
2780 int szArr,sw,iTypppArr;
2781 std::vector<int> stdvecTyyppArr;
2782 const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
2783 std::vector<int> tmp5(tmp4,tmp4+szArr);
2785 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
2788 static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) throw(INTERP_KERNEL::Exception)
2790 int szArr,sw,iTypppArr;
2791 std::vector<int> stdvecTyyppArr;
2792 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2793 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
2796 static PyObject *IsPartStructured(PyObject *li, PyObject *st) throw(INTERP_KERNEL::Exception)
2798 int szArr,sw,iTypppArr;
2799 std::vector<int> stdvecTyyppArr;
2800 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2801 int szArr2,sw2,iTypppArr2;
2802 std::vector<int> stdvecTyyppArr2;
2803 const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
2804 std::vector<int> tmp3(tmp2,tmp2+szArr2);
2805 std::vector< std::pair<int,int> > partCompactFormat;
2806 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
2807 PyObject *ret=PyTuple_New(2);
2808 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
2809 PyTuple_SetItem(ret,0,ret0Py);
2810 PyObject *ret1Py=PyList_New(partCompactFormat.size());
2811 for(std::size_t i=0;i<partCompactFormat.size();i++)
2813 PyObject *tmp4=PyTuple_New(2);
2814 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
2815 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
2816 PyList_SetItem(ret1Py,i,tmp4);
2818 PyTuple_SetItem(ret,1,ret1Py);
2824 //== MEDCouplingCMesh
2826 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2829 static MEDCouplingCMesh *New();
2830 static MEDCouplingCMesh *New(const std::string& meshName);
2831 MEDCouplingCMesh *clone(bool recDeepCpy) const;
2832 void setCoords(const DataArrayDouble *coordsX,
2833 const DataArrayDouble *coordsY=0,
2834 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
2835 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
2839 return MEDCouplingCMesh::New();
2841 MEDCouplingCMesh(const std::string& meshName)
2843 return MEDCouplingCMesh::New(meshName);
2845 std::string __str__() const throw(INTERP_KERNEL::Exception)
2847 return self->simpleRepr();
2849 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2851 std::ostringstream oss;
2852 self->reprQuickOverview(oss);
2855 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
2857 DataArrayDouble *ret=self->getCoordsAt(i);
2865 //== MEDCouplingCMesh End
2867 //== MEDCouplingCurveLinearMesh
2869 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2872 static MEDCouplingCurveLinearMesh *New();
2873 static MEDCouplingCurveLinearMesh *New(const std::string& meshName);
2874 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
2875 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
2877 MEDCouplingCurveLinearMesh()
2879 return MEDCouplingCurveLinearMesh::New();
2881 MEDCouplingCurveLinearMesh(const std::string& meshName)
2883 return MEDCouplingCurveLinearMesh::New(meshName);
2885 std::string __str__() const throw(INTERP_KERNEL::Exception)
2887 return self->simpleRepr();
2889 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2891 std::ostringstream oss;
2892 self->reprQuickOverview(oss);
2895 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
2897 DataArrayDouble *ret=self->getCoords();
2902 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
2904 int szArr,sw,iTypppArr;
2905 std::vector<int> stdvecTyyppArr;
2906 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
2907 self->setNodeGridStructure(tmp,tmp+szArr);
2912 //== MEDCouplingCurveLinearMesh End
2915 namespace ParaMEDMEM
2917 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
2920 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
2921 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
2922 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2923 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2924 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
2925 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
2926 void setName(const char *name) throw(INTERP_KERNEL::Exception);
2927 std::string getDescription() const throw(INTERP_KERNEL::Exception);
2928 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
2929 std::string getName() const throw(INTERP_KERNEL::Exception);
2930 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
2931 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
2932 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
2933 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
2934 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
2935 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
2936 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
2937 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
2938 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
2939 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
2940 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
2941 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
2942 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
2943 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
2944 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
2945 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
2947 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
2949 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
2952 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
2955 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
2957 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
2960 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
2963 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
2965 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
2966 return convertIntArrToPyList3(ret);
2969 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
2972 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
2973 PyObject *ret=PyTuple_New(2);
2974 PyObject *ret0Py=ret0?Py_True:Py_False;
2976 PyTuple_SetItem(ret,0,ret0Py);
2977 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2981 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
2983 DataArrayInt *ret1=0;
2984 MEDCouplingMesh *ret0=0;
2986 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2987 if (!SWIG_IsOK(res1))
2990 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2991 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
2995 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2997 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2998 da2->checkAllocated();
2999 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3001 PyObject *res = PyList_New(2);
3002 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3003 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3007 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
3009 DataArrayInt *ret1=0;
3011 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3012 PyObject *res=PyTuple_New(2);
3013 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3015 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3018 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3019 PyTuple_SetItem(res,1,res1);
3024 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3027 int v0; std::vector<int> v1;
3028 const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
3029 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3032 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3033 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3036 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3037 if (!SWIG_IsOK(res1))
3040 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3041 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3045 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3047 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3048 da2->checkAllocated();
3049 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3053 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3055 std::vector<int> tmp;
3056 self->getCellIdsHavingGaussLocalization(locId,tmp);
3057 DataArrayInt *ret=DataArrayInt::New();
3058 ret->alloc((int)tmp.size(),1);
3059 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3060 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3063 int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
3065 std::vector<int> inp0;
3066 convertPyToNewIntArr4(code,1,3,inp0);
3067 std::vector<const DataArrayInt *> inp1;
3068 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(idsPerType,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",inp1);
3069 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3074 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3077 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3078 static MEDCouplingFieldTemplate *New(TypeOfField type);
3079 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3080 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3083 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3085 return MEDCouplingFieldTemplate::New(f);
3088 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3090 return MEDCouplingFieldTemplate::New(type);
3093 std::string __str__() const throw(INTERP_KERNEL::Exception)
3095 return self->simpleRepr();
3098 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3100 std::ostringstream oss;
3101 self->reprQuickOverview(oss);
3107 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3110 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3111 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3112 void setTimeUnit(const std::string& unit);
3113 std::string getTimeUnit() const;
3114 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3115 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3116 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3117 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3118 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3119 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
3120 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3121 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3122 MEDCouplingFieldDouble *deepCpy() const;
3123 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3124 MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
3125 MEDCouplingFieldDouble *cellToNodeDiscretization() const throw(INTERP_KERNEL::Exception);
3126 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3127 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3128 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3129 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3130 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3131 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3132 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3133 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3134 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3135 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3136 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3137 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3138 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3139 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3140 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3141 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3142 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3143 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3144 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3145 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3146 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3147 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3148 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3149 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3150 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3151 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3152 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3153 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3154 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3155 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3156 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3157 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3158 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3159 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3160 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3161 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3162 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3163 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3164 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3165 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3166 void fillFromAnalytic(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3167 void fillFromAnalytic2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3168 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3169 void applyFunc(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3170 void applyFunc2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3171 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3172 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3173 void applyFunc(const std::string& func) throw(INTERP_KERNEL::Exception);
3174 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
3175 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
3176 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3177 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3178 double getMinValue() const throw(INTERP_KERNEL::Exception);
3179 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3180 double norm2() const throw(INTERP_KERNEL::Exception);
3181 double normMax() const throw(INTERP_KERNEL::Exception);
3182 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3183 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3184 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3185 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3186 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3187 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3188 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3189 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3190 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3191 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3192 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3193 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3194 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3195 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3196 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3197 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3198 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3199 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3200 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3201 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3202 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3203 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3205 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3207 return MEDCouplingFieldDouble::New(type,td);
3210 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3212 return MEDCouplingFieldDouble::New(ft,td);
3215 std::string __str__() const throw(INTERP_KERNEL::Exception)
3217 return self->simpleRepr();
3220 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3222 std::ostringstream oss;
3223 self->reprQuickOverview(oss);
3227 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3229 DataArrayDouble *ret=self->getArray();
3235 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3237 std::vector<DataArrayDouble *> arrs=self->getArrays();
3238 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3242 PyObject *ret=PyTuple_New(sz);
3243 for(int i=0;i<sz;i++)
3246 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3248 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3253 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3255 std::vector<const DataArrayDouble *> tmp;
3256 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3258 std::vector<DataArrayDouble *> arrs(sz);
3259 for(int i=0;i<sz;i++)
3260 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3261 self->setArrays(arrs);
3264 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3266 DataArrayDouble *ret=self->getEndArray();
3272 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3276 DataArrayDoubleTuple *aa;
3277 std::vector<double> bb;
3279 const MEDCouplingMesh *mesh=self->getMesh();
3281 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3282 int spaceDim=mesh->getSpaceDimension();
3283 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3284 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3286 int sz=self->getNumberOfComponents();
3287 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3288 self->getValueOn(spaceLoc,res);
3289 return convertDblArrToPyList(res,sz);
3292 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3294 int sz=self->getNumberOfComponents();
3295 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3296 self->getValueOnPos(i,j,k,res);
3297 return convertDblArrToPyList(res,sz);
3300 DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
3302 const MEDCouplingMesh *mesh(self->getMesh());
3304 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3307 double v0; ParaMEDMEM::DataArrayDouble *v1(0); ParaMEDMEM::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
3308 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
3309 mesh->getSpaceDimension(),true,nbPts);
3310 return self->getValueOnMulti(inp,nbPts);
3313 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3317 DataArrayDoubleTuple *aa;
3318 std::vector<double> bb;
3320 const MEDCouplingMesh *mesh=self->getMesh();
3322 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3323 int spaceDim=mesh->getSpaceDimension();
3324 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3325 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3328 int sz=self->getNumberOfComponents();
3329 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3330 self->getValueOn(spaceLoc,time,res);
3331 return convertDblArrToPyList(res,sz);
3334 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3336 if(self->getArray()!=0)
3337 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3340 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3341 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3342 self->setArray(arr);
3346 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3349 double tmp0=self->getTime(tmp1,tmp2);
3350 PyObject *res = PyList_New(3);
3351 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3352 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3353 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3357 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3360 double tmp0=self->getStartTime(tmp1,tmp2);
3361 PyObject *res = PyList_New(3);
3362 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3363 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3364 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3368 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3371 double tmp0=self->getEndTime(tmp1,tmp2);
3372 PyObject *res = PyList_New(3);
3373 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3374 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3375 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3378 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3380 int sz=self->getNumberOfComponents();
3381 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3382 self->accumulate(tmp);
3383 return convertDblArrToPyList(tmp,sz);
3385 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3387 int sz=self->getNumberOfComponents();
3388 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3389 self->integral(isWAbs,tmp);
3390 return convertDblArrToPyList(tmp,sz);
3392 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3394 int sz=self->getNumberOfComponents();
3395 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3396 self->getWeightedAverageValue(tmp,isWAbs);
3397 return convertDblArrToPyList(tmp,sz);
3399 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3401 int sz=self->getNumberOfComponents();
3402 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3404 return convertDblArrToPyList(tmp,sz);
3406 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3408 int sz=self->getNumberOfComponents();
3409 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3411 return convertDblArrToPyList(tmp,sz);
3413 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3415 int szArr,sw,iTypppArr;
3416 std::vector<int> stdvecTyyppArr;
3417 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3418 self->renumberCells(tmp,check);
3421 void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3423 int szArr,sw,iTypppArr;
3424 std::vector<int> stdvecTyyppArr;
3425 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3426 self->renumberCellsWithoutMesh(tmp,check);
3429 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3431 int szArr,sw,iTypppArr;
3432 std::vector<int> stdvecTyyppArr;
3433 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3434 self->renumberNodes(tmp,eps);
3437 void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3439 int szArr,sw,iTypppArr;
3440 std::vector<int> stdvecTyyppArr;
3441 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3442 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
3445 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3449 std::vector<int> multiVal;
3450 std::pair<int, std::pair<int,int> > slic;
3451 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3452 const MEDCouplingMesh *mesh=self->getMesh();
3454 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3455 int nbc=mesh->getNumberOfCells();
3456 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3463 std::ostringstream oss;
3464 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3465 throw INTERP_KERNEL::Exception(oss.str().c_str());
3468 return self->buildSubPart(&singleVal,&singleVal+1);
3473 int tmp=nbc+singleVal;
3474 return self->buildSubPart(&tmp,&tmp+1);
3478 std::ostringstream oss;
3479 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3480 throw INTERP_KERNEL::Exception(oss.str().c_str());
3486 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3490 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3495 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3496 daIntTyypp->checkAllocated();
3497 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3500 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3504 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3506 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";
3507 if(PyTuple_Check(li))
3509 Py_ssize_t sz=PyTuple_Size(li);
3511 throw INTERP_KERNEL::Exception(msg);
3512 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3515 std::vector<int> multiVal;
3516 std::pair<int, std::pair<int,int> > slic;
3517 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3518 if(!self->getArray())
3519 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3521 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3522 catch(INTERP_KERNEL::Exception& e)
3523 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3524 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3525 DataArrayDouble *ret0Arr=ret0->getArray();
3527 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3532 std::vector<int> v2(1,singleVal);
3533 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3534 ret0->setArray(aarr);
3539 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3540 ret0->setArray(aarr);
3545 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3546 std::vector<int> v2(nbOfComp);
3547 for(int i=0;i<nbOfComp;i++)
3548 v2[i]=slic.first+i*slic.second.second;
3549 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3550 ret0->setArray(aarr);
3554 throw INTERP_KERNEL::Exception(msg);
3559 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3562 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3565 double r1=self->getMaxValue2(tmp);
3566 PyObject *ret=PyTuple_New(2);
3567 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3568 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3572 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3575 double r1=self->getMinValue2(tmp);
3576 PyObject *ret=PyTuple_New(2);
3577 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3578 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3582 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3584 std::vector<int> tmp;
3585 convertPyToNewIntArr3(li,tmp);
3586 return self->keepSelectedComponents(tmp);
3589 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3591 std::vector<int> tmp;
3592 convertPyToNewIntArr3(li,tmp);
3593 self->setSelectedComponents(f,tmp);
3596 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3599 DataArrayDouble *a,*a2;
3600 DataArrayDoubleTuple *aa,*aa2;
3601 std::vector<double> bb,bb2;
3604 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
3605 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
3606 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3607 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3609 return self->extractSlice3D(orig,vect,eps);
3612 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3614 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
3617 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3619 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
3622 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3624 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.";
3625 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
3628 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3630 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3632 return (*self)-(*other);
3634 throw INTERP_KERNEL::Exception(msg);
3639 DataArrayDoubleTuple *aa;
3640 std::vector<double> bb;
3642 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3647 if(!self->getArray())
3648 throw INTERP_KERNEL::Exception(msg2);
3649 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3650 ret->applyLin(1.,-val);
3651 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3652 ret2->setArray(ret);
3657 if(!self->getArray())
3658 throw INTERP_KERNEL::Exception(msg2);
3659 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
3660 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3661 ret2->setArray(ret);
3666 if(!self->getArray())
3667 throw INTERP_KERNEL::Exception(msg2);
3668 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3669 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3670 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3671 ret2->setArray(ret);
3676 if(!self->getArray())
3677 throw INTERP_KERNEL::Exception(msg2);
3678 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3679 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3680 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3681 ret2->setArray(ret);
3685 { throw INTERP_KERNEL::Exception(msg); }
3689 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3691 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
3694 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3696 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
3699 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3701 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
3704 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3706 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.";
3707 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
3710 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3712 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3714 return (*self)/(*other);
3716 throw INTERP_KERNEL::Exception(msg);
3721 DataArrayDoubleTuple *aa;
3722 std::vector<double> bb;
3724 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3730 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
3731 if(!self->getArray())
3732 throw INTERP_KERNEL::Exception(msg2);
3733 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3734 ret->applyLin(1./val,0);
3735 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3736 ret2->setArray(ret);
3741 if(!self->getArray())
3742 throw INTERP_KERNEL::Exception(msg2);
3743 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
3744 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3745 ret2->setArray(ret);
3750 if(!self->getArray())
3751 throw INTERP_KERNEL::Exception(msg2);
3752 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3753 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3754 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3755 ret2->setArray(ret);
3760 if(!self->getArray())
3761 throw INTERP_KERNEL::Exception(msg2);
3762 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3763 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3764 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3765 ret2->setArray(ret);
3769 { throw INTERP_KERNEL::Exception(msg); }
3773 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3775 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
3778 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3780 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.";
3781 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
3784 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3786 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3788 return (*self)^(*other);
3790 throw INTERP_KERNEL::Exception(msg);
3795 DataArrayDoubleTuple *aa;
3796 std::vector<double> bb;
3798 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3803 if(!self->getArray())
3804 throw INTERP_KERNEL::Exception(msg2);
3805 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3807 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3808 ret2->setArray(ret);
3813 if(!self->getArray())
3814 throw INTERP_KERNEL::Exception(msg2);
3815 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
3816 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3817 ret2->setArray(ret);
3822 if(!self->getArray())
3823 throw INTERP_KERNEL::Exception(msg2);
3824 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3825 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3826 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3827 ret2->setArray(ret);
3832 if(!self->getArray())
3833 throw INTERP_KERNEL::Exception(msg2);
3834 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3835 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3836 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3837 ret2->setArray(ret);
3841 { throw INTERP_KERNEL::Exception(msg); }
3845 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
3847 return self->negate();
3850 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3852 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.";
3853 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
3856 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3858 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3862 Py_XINCREF(trueSelf);
3866 throw INTERP_KERNEL::Exception(msg);
3871 DataArrayDoubleTuple *aa;
3872 std::vector<double> bb;
3874 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3879 if(!self->getArray())
3880 throw INTERP_KERNEL::Exception(msg2);
3881 self->getArray()->applyLin(1.,val);
3882 Py_XINCREF(trueSelf);
3887 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3890 Py_XINCREF(trueSelf);
3895 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3896 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3897 ret2->setArray(aaa);
3899 Py_XINCREF(trueSelf);
3904 if(!self->getArray())
3905 throw INTERP_KERNEL::Exception(msg2);
3906 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3907 self->getArray()->addEqual(aaa);
3908 Py_XINCREF(trueSelf);
3912 { throw INTERP_KERNEL::Exception(msg); }
3916 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3918 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.";
3919 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
3922 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3924 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3928 Py_XINCREF(trueSelf);
3932 throw INTERP_KERNEL::Exception(msg);
3937 DataArrayDoubleTuple *aa;
3938 std::vector<double> bb;
3940 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3945 if(!self->getArray())
3946 throw INTERP_KERNEL::Exception(msg2);
3947 self->getArray()->applyLin(1.,-val);
3948 Py_XINCREF(trueSelf);
3953 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3956 Py_XINCREF(trueSelf);
3961 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3962 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3963 ret2->setArray(aaa);
3965 Py_XINCREF(trueSelf);
3970 if(!self->getArray())
3971 throw INTERP_KERNEL::Exception(msg2);
3972 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3973 self->getArray()->substractEqual(aaa);
3974 Py_XINCREF(trueSelf);
3978 { throw INTERP_KERNEL::Exception(msg); }
3982 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3984 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.";
3985 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
3988 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3990 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3994 Py_XINCREF(trueSelf);
3998 throw INTERP_KERNEL::Exception(msg);
4003 DataArrayDoubleTuple *aa;
4004 std::vector<double> bb;
4006 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4011 if(!self->getArray())
4012 throw INTERP_KERNEL::Exception(msg2);
4013 self->getArray()->applyLin(val,0);
4014 Py_XINCREF(trueSelf);
4019 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4022 Py_XINCREF(trueSelf);
4027 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4028 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4029 ret2->setArray(aaa);
4031 Py_XINCREF(trueSelf);
4036 if(!self->getArray())
4037 throw INTERP_KERNEL::Exception(msg2);
4038 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4039 self->getArray()->multiplyEqual(aaa);
4040 Py_XINCREF(trueSelf);
4044 { throw INTERP_KERNEL::Exception(msg); }
4048 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4050 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.";
4051 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4054 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4056 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4060 Py_XINCREF(trueSelf);
4064 throw INTERP_KERNEL::Exception(msg);
4069 DataArrayDoubleTuple *aa;
4070 std::vector<double> bb;
4072 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4078 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4079 if(!self->getArray())
4080 throw INTERP_KERNEL::Exception(msg2);
4081 self->getArray()->applyLin(1./val,0);
4082 Py_XINCREF(trueSelf);
4087 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4090 Py_XINCREF(trueSelf);
4095 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4096 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4097 ret2->setArray(aaa);
4099 Py_XINCREF(trueSelf);
4104 if(!self->getArray())
4105 throw INTERP_KERNEL::Exception(msg2);
4106 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4107 self->getArray()->divideEqual(aaa);
4108 Py_XINCREF(trueSelf);
4112 { throw INTERP_KERNEL::Exception(msg); }
4116 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4118 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.";
4119 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4122 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4124 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4128 Py_XINCREF(trueSelf);
4132 throw INTERP_KERNEL::Exception(msg);
4137 DataArrayDoubleTuple *aa;
4138 std::vector<double> bb;
4140 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4145 if(!self->getArray())
4146 throw INTERP_KERNEL::Exception(msg2);
4147 self->getArray()->applyPow(val);
4148 Py_XINCREF(trueSelf);
4153 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4156 Py_XINCREF(trueSelf);
4161 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4162 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4163 ret2->setArray(aaa);
4165 Py_XINCREF(trueSelf);
4170 if(!self->getArray())
4171 throw INTERP_KERNEL::Exception(msg2);
4172 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4173 self->getArray()->powEqual(aaa);
4174 Py_XINCREF(trueSelf);
4178 { throw INTERP_KERNEL::Exception(msg); }
4182 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4184 std::vector<const MEDCouplingFieldDouble *> tmp;
4185 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4186 return MEDCouplingFieldDouble::MergeFields(tmp);
4189 static void WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
4191 std::vector<const MEDCouplingFieldDouble *> tmp;
4192 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4193 MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4198 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4201 int getNumberOfFields() const;
4202 MEDCouplingMultiFields *deepCpy() const;
4203 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4204 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4205 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4206 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4207 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4210 std::string __str__() const throw(INTERP_KERNEL::Exception)
4212 return self->simpleRepr();
4214 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4216 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4217 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4219 std::vector<MEDCouplingFieldDouble *> fs(sz);
4220 for(int i=0;i<sz;i++)
4221 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4222 return MEDCouplingMultiFields::New(fs);
4224 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4226 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4227 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4229 std::vector<MEDCouplingFieldDouble *> fs(sz);
4230 for(int i=0;i<sz;i++)
4231 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4232 return MEDCouplingMultiFields::New(fs);
4234 PyObject *getFields() const
4236 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4237 int sz=fields.size();
4238 PyObject *res = PyList_New(sz);
4239 for(int i=0;i<sz;i++)
4243 fields[i]->incrRef();
4244 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4248 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4253 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4255 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4259 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4262 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4264 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4266 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4268 PyObject *res = PyList_New(sz);
4269 for(int i=0;i<sz;i++)
4274 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4278 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4283 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4285 std::vector<int> refs;
4286 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4288 PyObject *res = PyList_New(sz);
4289 for(int i=0;i<sz;i++)
4294 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4298 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4302 PyObject *ret=PyTuple_New(2);
4303 PyTuple_SetItem(ret,0,res);
4304 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4307 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4309 std::vector<DataArrayDouble *> ms=self->getArrays();
4311 PyObject *res = PyList_New(sz);
4312 for(int i=0;i<sz;i++)
4317 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4321 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4326 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4328 std::vector< std::vector<int> > refs;
4329 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4331 PyObject *res = PyList_New(sz);
4332 PyObject *res2 = PyList_New(sz);
4333 for(int i=0;i<sz;i++)
4338 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4342 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4344 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4347 PyObject *ret=PyTuple_New(2);
4348 PyTuple_SetItem(ret,0,res);
4349 PyTuple_SetItem(ret,1,res2);
4355 class MEDCouplingDefinitionTime
4358 MEDCouplingDefinitionTime();
4359 void assign(const MEDCouplingDefinitionTime& other);
4360 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4361 double getTimeResolution() const;
4362 std::vector<double> getHotSpotsTime() const;
4365 std::string __str__() const throw(INTERP_KERNEL::Exception)
4367 std::ostringstream oss;
4368 self->appendRepr(oss);
4372 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4374 int meshId,arrId,arrIdInField,fieldId;
4375 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4376 PyObject *res=PyList_New(4);
4377 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4378 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4379 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4380 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4384 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4386 int meshId,arrId,arrIdInField,fieldId;
4387 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4388 PyObject *res=PyList_New(4);
4389 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4390 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4391 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4392 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4398 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4401 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4402 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4406 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4408 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4409 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4411 std::vector<MEDCouplingFieldDouble *> fs(sz);
4412 for(int i=0;i<sz;i++)
4413 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4414 return MEDCouplingFieldOverTime::New(fs);
4416 std::string __str__() const throw(INTERP_KERNEL::Exception)
4418 return self->simpleRepr();
4420 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4422 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4423 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4425 std::vector<MEDCouplingFieldDouble *> fs(sz);
4426 for(int i=0;i<sz;i++)
4427 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4428 return MEDCouplingFieldOverTime::New(fs);
4436 __filename=os.environ.get('PYTHONSTARTUP')
4437 if __filename and os.path.isfile(__filename):
4438 execfile(__filename)